Spring cloud Spring云使用者参数有效负载总是获取字节数组对象
我正在使用SpringCloudEdgware。SR3和SpringCloudStream2.0.1版本 我已经使用SpringCloudStream2.0创建了testprocessor应用程序。 创建样本流:Spring cloud Spring云使用者参数有效负载总是获取字节数组对象,spring-cloud,spring-cloud-stream,spring-cloud-dataflow,Spring Cloud,Spring Cloud Stream,Spring Cloud Dataflow,我正在使用SpringCloudEdgware。SR3和SpringCloudStream2.0.1版本 我已经使用SpringCloudStream2.0创建了testprocessor应用程序。 创建样本流: stream create TEST1 --definition "http --server.port=8888 | testprocessor | uploader --spring.cloud.stream.bindings.input.contentType='text/pla
stream create TEST1 --definition "http --server.port=8888 | testprocessor | uploader --spring.cloud.stream.bindings.input.contentType='text/plain1' "
部署在Spring云本地服务器中
//testprocessor apps method signature is
@StreamListener(Processor.INPUT)
@sendto(Processor.OUTPUT)
public String transform(Object payload) {
}
在这个应用的application.properties中,我配置了以下属性
spring.cloud.stream.bindings.input.content type=application/json代码>
示例输入数据:
http post --contentType 'application/json' --data '{\"isbn\": \"1599869772", "title": "The Art of War", "author": "Sun Tzu"}' --target http://localhost:8888
当我发布上述示例数据时,我总是得到对象负载是byte[]
objectlike[B@5b2ff6e7
但未获取实际的JSON字符串。
在这个问题上你能帮忙吗
注意:如果我使用spring cloud stream 1.3.1版本构建相同的testprocessor应用程序,它工作正常。我得到的是JSON字符串。为什么它不能使用spring cloud stream 2.0.1工作?transformer
应用程序有一个表达式
选项,因此您可以这样做:
--expression='new String(payload)'
您将在公共字符串转换(对象负载)
方法中获得一个JSON字符串
相关问题: