JSON message converter returns null for empty POJO
castelblanque opened this issue · 2 comments
Describe the issue
When using an empty POJO (class without fields), JsonMessageConverter
converts it to null instead of a representation of an empty JSON ({}
).
To Reproduce
Steps to reproduce the behavior:
- Create POJO class e.g.
public class EmptyPOJO { }
- Use
JsonMessageConverter#convertToInternal
method to convert the POJO. It usesjsonMapper.toJson(payload)
inside. - Returned value is
null
Version of the framework
Spring Cloud Stream 4.0.4
Expected behavior
JSON message converter returns the representation of an empty JSON: {}
Additional context
Issue appeared when migrating from Spring Boot 2 to 3.0.12. Stream tests that we had passing in v2 started to fail, and we debugged the problem down to this issue.
@castelblanque JsonMessageConverter
is from Spring Cloud Function. I am moving this issue over there.
Ok , 4.0.4 is already EOL. In fact the entire 4.0.x is EOL, so please switch to 4.1.0 or 4.1.1.
As for this issue, I believe it has ben addressed quite recently, but it was related to AWS, so i am fixing it for the entire framework now. Shouldn't be long