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

Regression bug: @Serdeable.Deserializable(as = ...) not working as expected #1040

Open
Nahuel92 opened this issue Feb 11, 2025 · 0 comments
Open

Comments

@Nahuel92
Copy link

Nahuel92 commented Feb 11, 2025

Expected Behavior

@Serdeable.Deserializable(as = ...) Should be able to deserialize correctly using the provided data type

Actual Behaviour

When using @Serdeable.Deserializable(as = com.google.common.collect.ImmutableList), Micronaut Serialization throws an exception:

Error decoding HTTP response body: No bean introspection available for type [class com.google.common.collect.ImmutableList]. Ensure the class is annotated with io.micronaut.core.annotation.Introspected.

Note

I was able to identify that this bug was introduced in Micronaut Serialization 2.12.1

Steps To Reproduce

I attached an example app, but if you want to do it manually:

  1. Create a new Micronaut project with HTTP client, Guava and WireMock (or a similar one)
  2. Create a DTO and add collection field to it. Annotate it with @Serdeable.Deserializable(as = ...), for example @Serdeable.Deserializable(as = com.google.common.collect.ImmutableList)
  3. Create an HTTP client with a method that has the previously created DTO as return type
  4. Create a test, use WireMock (or a similar one) to stub the HTTP response and write a simple assert (e.g., assert that the collection is empty)
  5. When you run it, you'll get the exception.
  6. Now, in the pom.xml file, change the micronaut.serialization.version to 2.12.0.
  7. Clean-compile and re-run the test, and this time it will pass.

Let me know if more information is required. Thanks!

Environment Information

OS: Linux / Windows / MacOS
JDK Version: 21

Example Application

https://github.com/Nahuel92/poc-projects/tree/master/micronaut/micronaut-serialization-bug

Version

4.7.5

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

No branches or pull requests

1 participant