Allow beans created in MockRestServiceServerAutoConfiguration to be replaced by user-provided alternatives by HuitaePark · Pull Request #48825 · spring-projects/spring-boot

wilkinsona

@HuitaePark

Previously, MockRestServiceServerAutoConfiguration unconditionally defined a
MockServerRestClientCustomizer bean, which prevented user overrides.

This commit adds @ConditionalOnMissingBean to ensure the auto-configuration
backs off when a user-provided customizer is present.

Closes spring-projectsgh-46853

Signed-off-by: HuitaePark <qkrgmlxo3174@gmail.com>

wilkinsona

@wilkinsona wilkinsona changed the title Allow user-override of MockRestServiceServer beans Allow beans created in MockRestServiceServerAutoConfiguration to be overridden

Jan 16, 2026

@wilkinsona wilkinsona changed the title Allow beans created in MockRestServiceServerAutoConfiguration to be overridden Allow beans created in MockRestServiceServerAutoConfiguration to be replaced by user-provided alternatives

Jan 16, 2026

wilkinsona pushed a commit that referenced this pull request

Jan 16, 2026
Previously, MockRestServiceServerAutoConfiguration unconditionally
defined its beans, preventing the user from providing an alternative.

This commit adds @ConditionalOnMissingBean to ensure the auto-configuration
backs off when a user-provided alternatives are present.

See gh-48825

Signed-off-by: HuitaePark <qkrgmlxo3174@gmail.com>

wilkinsona added a commit that referenced this pull request

Jan 16, 2026