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.
Using spring-boot-starter-kotlinx-serialization-json seems to work out of the box, but when customizing the Json instance using a
KotlinxSerializationJsonBuilderCustomizerit seems likeKotlinxSerializationJsonCodecConfigurationdoesn'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
KotlinxSerializationJsonCodecConfigurationdoes, 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.