Describe the issue
Upgrading from spring-cloud-stream 2023.0.3 to 2023.0.4 results in the following error:
Failed to bind properties under 'spring.cloud.stream.kafka.default.producer.message-key-expression' to org.springframework.expression.Expression:
Property: spring.cloud.stream.kafka.default.producer.message-key-expression
Value: "headers['id']"
Origin: class path resource [application.yml] - 5:48
Reason: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [org.springframework.expression.Expression]
This looks like a regression bug that was previously reported in #2283
To Reproduce
- Generate a new project from https://start.spring.io/index.html (spring-boot: 3.3.6, spring-cloud: 2023.0.4)
- Add the kafka binder
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
- use the following application.yml
spring:
application.name: demo
cloud:
stream:
kafka:
default.producer.message-key-expression: headers['id']
binder:
brokers: localhost:9092
bindings:
test-out-0:
destination: out
test-in-0:
destination: in
group: test
Add a consumer in the Application.class
@Bean
public Consumer<Message<String>> test() {
return message -> System.out.println("Received message: " + message);
}
- run
mvn spring-boot:run
- Error will be printed out in the logs.
Version of the framework
2023.0.4
Expected behavior
Should convert the expression as it does in 2023.0.3
Describe the issue
Upgrading from spring-cloud-stream 2023.0.3 to 2023.0.4 results in the following error:
This looks like a regression bug that was previously reported in #2283
To Reproduce
Add a consumer in the
Application.classmvn spring-boot:runVersion of the framework
2023.0.4
Expected behavior
Should convert the expression as it does in
2023.0.3