Skip to content

Fix ordering of Kotlinx Serialization CodecCustomizer#50428

Open
dmitrysulman wants to merge 1 commit into
spring-projects:mainfrom
dmitrysulman:add-order-to-kotlinx-jsonc-codec-customizer
Open

Fix ordering of Kotlinx Serialization CodecCustomizer#50428
dmitrysulman wants to merge 1 commit into
spring-projects:mainfrom
dmitrysulman:add-order-to-kotlinx-jsonc-codec-customizer

Conversation

@dmitrysulman
Copy link
Copy Markdown
Contributor

@dmitrysulman dmitrysulman commented May 13, 2026

Kotlinx Serialization CodecCustomizer introduced in d161aaf lacks an explicit order, meaning it defaults to LOWEST_PRECEDENCE. This prevents user-provided customizers from overriding Spring Boot defaults, as the default customizer runs last and overwrites previous configurations.

A similar issue for message converters was fixed in 3948e7c. The Jackson CodecCustomizer is already explicitly ordered:

@Bean
@Order(0)
@ConditionalOnBean(JsonMapper.class)
CodecCustomizer jacksonCodecCustomizer(JsonMapper jsonMapper) {
return (configurer) -> {
CodecConfigurer.DefaultCodecs defaults = configurer.defaultCodecs();
defaults.jacksonJsonDecoder(new JacksonJsonDecoder(jsonMapper));
defaults.jacksonJsonEncoder(new JacksonJsonEncoder(jsonMapper));
};
}

This PR adds @Order(0) to the kotlinxJsonCodecCustomizer bean to address this issue.

See #48070 and #48609

@bclozel fyi

…fter it

Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 13, 2026
@bclozel bclozel self-assigned this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants