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
Calling that endpoint will result in the following:
java.lang.IllegalArgumentException: Unrecognized Type: org.springframework.core.ResolvableType$EmptyType@6b003199
at com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1222) ~[jackson-databind-2.9.0.pr4.jar:2.9.0.pr4]
at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:616) ~[jackson-databind-2.9.0.pr4.jar:2.9.0.pr4]
at org.springframework.http.codec.json.Jackson2CodecSupport.getJavaType(Jackson2CodecSupport.java:89) ~[spring-web-5.0.0.BUILD-20170703.083012-345.jar:5.0.0.BUILD-SNAPSHOT]
at org.springframework.http.codec.json.Jackson2JsonEncoder.encodeValue(Jackson2JsonEncoder.java:144) ~[spring-web-5.0.0.BUILD-20170703.083012-345.jar:5.0.0.BUILD-SNAPSHOT]
at org.springframework.http.codec.json.Jackson2JsonEncoder.lambda$encode$0(Jackson2JsonEncoder.java:125) ~[spring-web-5.0.0.BUILD-20170703.083012-345.jar:5.0.0.BUILD-SNAPSHOT]
It seems that the ResponseBodyResultHandler looks at the method return type to get the type information and because this endpoint exposes Object, this leads to an instance of ResolvableType.EmptyType(), which Jackson doesn't know how to deal with.
In those cases, should we derive the type at runtime?
If this is intended behavior, should we forbid Object return types in handlers and perform a hard check at startup?
It does work if the actual type is the POJO to render. I applied a small fix so that the generic type we determine from Mono doesn't end up being ResolvableTypeNone.
Brian Clozel opened SPR-15731 and commented
Given this WebFlux endpoint:
Calling that endpoint will result in the following:
It seems that the
ResponseBodyResultHandler
looks at the method return type to get the type information and because this endpoint exposesObject
, this leads to an instance ofResolvableType.EmptyType()
, which Jackson doesn't know how to deal with.In those cases, should we derive the type at runtime?
If this is intended behavior, should we forbid
Object
return types in handlers and perform a hard check at startup?Affects: 5.0 RC2
Issue Links:
The text was updated successfully, but these errors were encountered: