Skip to content

Fix ordering of Kotlinx Serialization CodecCustomizer#50428

Closed
dmitrysulman wants to merge 1 commit into
spring-projects:4.0.xfrom
dmitrysulman:add-order-to-kotlinx-jsonc-codec-customizer
Closed

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

Conversation

@dmitrysulman

@dmitrysulman dmitrysulman commented May 13, 2026

Copy link
Copy Markdown
Contributor

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

@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
@dmitrysulman
dmitrysulman force-pushed the add-order-to-kotlinx-jsonc-codec-customizer branch from aea894d to 568b78d Compare May 21, 2026 11:55
@dmitrysulman

Copy link
Copy Markdown
Contributor Author

@bclozel just wanted to check if this PR is relevant and can be added to the next Boot version

@bclozel bclozel added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 16, 2026
@bclozel bclozel modified the milestones: 4.0.8, 4.1.1 Jul 16, 2026
@bclozel
bclozel changed the base branch from main to 4.0.x July 16, 2026 12:39
…fter it

Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
@bclozel
bclozel force-pushed the add-order-to-kotlinx-jsonc-codec-customizer branch from 568b78d to 352a903 Compare July 16, 2026 12:40
@bclozel bclozel closed this in f83576e Jul 16, 2026
@bclozel

bclozel commented Jul 16, 2026

Copy link
Copy Markdown
Member

Thanks @dmitrysulman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants