-
Notifications
You must be signed in to change notification settings - Fork 629
Problem in deserialization when defining consumers with generics types #1251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We have encountered the same issue very recently when trying to upgrade the Spring Boot version in one of our applications. This way of using a subclass (or a sub-interface) of The actual change in behaviour is in I am not sure what's the best way to go tackle this issue or if the way we're using Spring Cloud Stream is even considered correct, but it has been working well for us so far. (We use a sub-interface of |
Can you please try it with Spring Cloud 2024.0.1. There were regressions with some of the refactoring we did |
Hi @olegz, Unfortunately, the same problem persists after updating to Spring Cloud 2024.0.1. To reproduce it, simply start the application found in the repository: |
Tthis change specifically addresses the use of generics
Tthis change specifically addresses the use of generics
Uh oh!
There was an error while loading. Please reload this page.
Describe the issue
When implementing a consumer class with generic types that implement
java.util.Consumer
, we have observed that depending on how the consumer bean is defined, the deserialization of messages works correctly or not.We have created this repository that describes this situation, defining the Consumer beans "correctly" or "incorrectly".
We understand that it should work both ways. Additionally, it is a good practice and recommended by Spring to define the implementation as the bean output rather than the interface.
To Reproduce
Steps to reproduce the behavior:
Version of the framework
Spring-Boot 3.4.2
Spring Cloud 2024.0.0
Observed outcome
The message is not deserialized and arrives in byte[].
For batch mode the message payload is null in the list of messages.
Expected behavior
The message is deserialized correctly by the converter.
Additional context
The same behavior occurs for consumer in batch-mode.
Works OK when the bean is defined in this manner:
The text was updated successfully, but these errors were encountered: