Spring / Spring Tools
Merged upstreamCorrectnessMerged Jun 17, 2026 PT

Avoid false bean-method warnings on overrides

Fixed a Spring Tools validation false positive so public @Bean methods that override superclass or interface methods are not flagged by JAVA_PUBLIC_BEAN_METHOD.

spring-projects/spring-tools · #1915

Problem

The Spring Boot language server warned that public @Bean methods should not be public even when the method was required by an inherited contract, such as WebMvcConfigurer#getValidator(). That produced conflicting guidance for valid @Override methods.

Approach

Updated BeanMethodNotPublicReconciler to rely on JDT method override binding behavior for inherited methods, including methods declared in dependency JARs, and added a focused WebMvcConfigurer override fixture.

Impact and scope

  • Removes noisy validation warnings for valid Spring MVC and Spring Boot configuration code.
  • Improves IDE trust by aligning the @Bean visibility rule with Java override requirements instead of treating every public @Bean method as suspicious.
  • Covers inherited interface and superclass contracts, including framework methods resolved from dependency JARs.

Validation

  • Added Spring validation coverage for a public @Bean override using WebMvcConfigurer#getValidator().
  • Updated BeanMethodNotPublicReconciler tests around inherited override detection.
  • PR validation ran the Spring Boot language-server Maven test slice for SpringValidationBeanMethodNotPublicTest and BeanMethodNotPublicReconcilerTest.