Spring WebFlux 5.2.30

The writeBody method of AbstractMessageWriterResultHandler class uses actualElementType which is inferred from the body argument looks like DataList<?>not the DataList<String> to check which HttpMessageWriter is available, the HttpMessageWriter class invokes KotlinSerializationJsonEncoder's canEncode method, the actualElementType can't be used to get the serializer, so the kotlin serialization throws an exception. The serialization was fallback to using Jackson.

Spring Spring WebFlux doesn't support generic type serialization using kotlin serialization.

Spring Spring WebFlux doesn't support generic type serialization using kotlin serialization.

Spring Spring WebFlux doesn't support generic type serialization using kotlin serialization.

Spring Spring WebFlux doesn't support generic type serialization using kotlin serialization.

Comment From: sdeleuze

Could you please provide a reproducer for this issue? Is your DataList class annotated with @Serializable?

Comment From: danny-su

Could you please provide a reproducer for this issue? Is your DataList class annotated with @Serializable?

I create a new project, but I can't reproduce it, the new code works as expected, I close the issue.