Skip to content

GH-2273 - Resolve JsonMapper via getIfUnique on WebFlux stack - #2555

Open
arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:fix/2273-multiple-jsonmapper
Open

arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:fix/2273-multiple-jsonmapper

Conversation

@arimu1

@arimu1 arimu1 commented Sep 13, 2026

Copy link
Copy Markdown

Summary

  • Use ObjectProvider.getIfUnique(JsonMapper::new) instead of getIfAvailable when wiring hypermedia codecs for WebFlux, WebClient, and WebTest (Web MVC already used getIfUnique).
  • When the application defines multiple JsonMapper beans, getIfAvailable still throws NoUniqueBeanDefinitionException during hypermediaWebFluxConfigurer creation; getIfUnique falls back to a dedicated mapper instance so @EnableHypermediaSupport can start without @Primary.
  • Add MultipleJsonMapperWebFluxConfigurationTest reproducing Problem with muliple ObjectMapper and WebFluxHateoasConfiguration.HypermediaWebFluxConfigurer.hypermediaWebFluxConfigurer(...) #2273 with two named JsonMapper beans.

Test plan

  • ./mvnw test -Dtest=MultipleJsonMapperWebFluxConfigurationTest
  • ./mvnw test -Dtest=HypermediaWebFluxConfigurerTest
  • ./mvnw test (JDK 21 / Temurin)

Closes #2273

…x stack.

When multiple JsonMapper beans are registered, ObjectProvider.getIfAvailable
still fails with NoUniqueBeanDefinitionException. Align WebFlux, WebClient, and
WebTest configuration with the existing Web MVC path that uses getIfUnique and
falls back to a dedicated mapper instance.

Closes spring-projects#2273

Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with muliple ObjectMapper and WebFluxHateoasConfiguration.HypermediaWebFluxConfigurer.hypermediaWebFluxConfigurer(...)

1 participant