You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Micronaut RxJava2 module in a Micronaut 3.x application the service always returns an empty json object ({}) when the controller method uses a RxJava2 return type (e.g. io.reactivex.Single).
Since this isn't the case for Reactor and RxJava3 types (they work as expected) I compared the micronaut-rxjava2 and micronaut-rxjava3 projects and it seems like the GraalVM reflection configuration is missing in the micronaut-rxjava2 jar, probably due to the absence of the micronaut-graal annotation processor in micronaut-rxjava2/build.gradle (see micronaut-rxjava3/build.gradle).
The trace logs shows (when returning io.reactivex.Single<List<MyObject>>):
While for both Reactor and RxJava3 based return types the actual objects are shown (when returning io.reactivex.rxjava3.core.Single<List<MyObject>> or reactor.core.publisher.Mono<List<MyObject>>):
I was under the impression that Micronaut didn't use reflection for json serialization but uses the BeanIntrospection classes generated based on the @Introspected annotation, but it looks like it is missing reflection information for the RxJava2 classes.
Note that adding @TypeHint(value = io.reactivex.Single.class) to the application works around this issue.
When using the Micronaut RxJava2 module in a Micronaut 3.x application the service always returns an empty json object (
{}
) when the controller method uses a RxJava2 return type (e.g.io.reactivex.Single
).Since this isn't the case for Reactor and RxJava3 types (they work as expected) I compared the micronaut-rxjava2 and micronaut-rxjava3 projects and it seems like the GraalVM reflection configuration is missing in the micronaut-rxjava2 jar, probably due to the absence of the micronaut-graal annotation processor in micronaut-rxjava2/build.gradle (see micronaut-rxjava3/build.gradle).
The trace logs shows (when returning
io.reactivex.Single<List<MyObject>>
):While for both Reactor and RxJava3 based return types the actual objects are shown (when returning
io.reactivex.rxjava3.core.Single<List<MyObject>>
orreactor.core.publisher.Mono<List<MyObject>>
):I was under the impression that Micronaut didn't use reflection for json serialization but uses the BeanIntrospection classes generated based on the
@Introspected
annotation, but it looks like it is missing reflection information for the RxJava2 classes.Note that adding
@TypeHint(value = io.reactivex.Single.class)
to the application works around this issue.Steps to Reproduce
Expected Behaviour
The service should return the objects created in the controller method
Actual Behaviour
An empty json object (
{}
) is returnedEnvironment Information
The text was updated successfully, but these errors were encountered: