配置项类型转换错误
老师,我跟您的demo写代码的时候,发现
partition-key-expression: 1 注释掉这一行就可以启动。 老师您的项目也可以正常启动。 只有这个yml格式的这一项配置,会引起问题
这一项会报如下错误:
Description: Failed to bind properties under 'spring.cloud.stream.bindings.group-producer.producer.partition-key-expression' to org.springframework.expression.Expression: Property: spring.cloud.stream.bindings.group-producer.producer.partition-key-expression Value: 1 Origin: class path resource [application.yml]:28:39 Reason: No converter found capable of converting from type [java.lang.Integer] to type [@com.fasterxml.jackson.databind.annotation.JsonSerialize org.springframework.expression.Expression] Action: Update your application's configuration
部分配置如下:
spring: application: name: stream-sample cloud: stream: bindings: #绑定channel到broadcast myTopic-consumer: destination: broadcast myTopic-producer: destination: broadcast #消息分组 group-consumer: destination: group-topic group: Group-B #消费分区配置 consumer: partitioned: true group-producer: destination: group-topic producer: #2个消费分区 partition-conut: 2 #SpEL(Key Resolver) #只有索引参数为1的节点(消费者),才能消费消息 partition-key-expression: 1
10
收起
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星