Skip to content
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

Deserialization problem with Spring Cloud Stream & Spring Cloud Function #1163

Closed
mfrechePgest opened this issue Jul 17, 2024 · 8 comments
Closed
Assignees
Labels
Milestone

Comments

@mfrechePgest
Copy link

mfrechePgest commented Jul 17, 2024

Describe the issue

Since Spring Cloud 2023.0.3, most of our Spring Cloud Stream bindings are failing to deserialize JSON objects.
It seems Jackson property DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES is now enabled by default.
It wasn't the case in 2023.0.2.

If I send in my message queue a JSON object with more fields than the DTO knows about : it fails during deserialization.

To Reproduce
Here is a sample repo where problem is shown.
There are 2 branches with each Spring Cloud version.

You can execute MessagingStreamsIT.
Every test runs fine in 2023.0.2 branch, while it fails in 2023.0.3.

As it's shown in some tests, adding @JsonIgnoreProperties(ignoreUnknown = true) on every DTO object seems to be a workaround.

@mfrechePgest mfrechePgest changed the title Deserialization Deserialization problem with Spring Cloud Stream & Spring Cloud Function Jul 17, 2024
@olegz olegz added the bug label Jul 17, 2024
@olegz olegz self-assigned this Jul 17, 2024
@olegz
Copy link
Contributor

olegz commented Jul 17, 2024

Indeed we just added it to solve another issue. i will take a look and see what we can do

@olegz
Copy link
Contributor

olegz commented Jul 17, 2024

Here is the issue where it was introduced - #1097

@olegz
Copy link
Contributor

olegz commented Jul 17, 2024

Actually i take this back, the only deserialisation feature we have currently is mapper.configure(DeserializationFeature.FAIL_ON_TRAILING_TOKENS, true);.
Where do you see it being set?

@mfrechePgest
Copy link
Author

I didn't, actually

Symptoms are just "as if" this property was forced under the hood.

@olegz
Copy link
Contributor

olegz commented Jul 17, 2024

Let me try your sample

@olegz
Copy link
Contributor

olegz commented Jul 17, 2024

I see the issue. It's in s-c-function. I will transfer it there and push the fix shortly

@olegz olegz transferred this issue from spring-cloud/spring-cloud-stream Jul 17, 2024
@olegz olegz closed this as completed in 766cf9e Jul 17, 2024
@olegz olegz added this to the 4.1.4 milestone Jul 17, 2024
@mfrechePgest
Copy link
Author

Seems like PR #1162 addressed the same issue in a diffrent way too

@ElectroLutz
Copy link

ElectroLutz commented Jul 22, 2024

@olegz This fix doesn't resolve the problem of not all modules being registered. For instance the Kotlin-Module is not registered and that leads to problems when using Kotlin (data classes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants