spring-projects / spring-projects/spring-boot
Possible autoconfigure bug with kotlinx serialization and webflux
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
Using spring-boot-starter-kotlinx-serialization-json seems to work out of the box, but when customizing the Json instance using a KotlinxSerializationJsonBuilderCustomizer it seems like KotlinxSerializationJsonCodecConfiguration doesn't find a Json instance with its @ConditionalOnBean(Json.class). That again leads to the customization not being applied to the Json instance used for json serialization and serialization fails.
I have created a minimal project showing the problem here. In the sample project I've defined a bean matching what KotlinxSerializationJsonCodecConfiguration does, and if that bean is enabled the tests work as expected. The sample project is using Spring Boot 4.1.1 and the same behavior is found in 4.0.8 as well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with KotlinxSerializationJsonCodecConfiguration and its @ConditionalOnBean(Json.class), then reproduce the behavior in the linked minimal sample project using the KotlinxSerializationJsonBuilderCustomizer. Compare the configured Json bean with the instance used by WebFlux serialization; done means customization is applied and the sample tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin, spring-boot
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100