Summary

In Sprint Boot 3.5, the injection of the Environment into the factory method of the MethodValidationPostProcessor in ValidationAutoConfiguration produces the non-eligibility warning for beans that contribute to the Environment.

I can reproduce this with 3.5.0-RC1 and also 3.5.0-SNAPSHOT. With 3.4.5, the warnings are not logged.

I don't think the warnings point to a serious issue in this case, but they are confusing to users.

How to reproduce

In the Spring Initializr, build a new project with 3.5.0-RC1 or 3.5.0-SNAPSHOT, and choose

  • spring-boot-starter-validation
  • spring-boot-starter-jdbc
  • Flyway
  • H2

then the app will log the following warnings on start-up:

2025-05-20T15:31:36.284+02:00  WARN 19501 --- [demo] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration' of type [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
2025-05-20T15:31:36.284+02:00  WARN 19501 --- [demo] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'stringOrNumberMigrationVersionConverter' of type [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$StringOrNumberToMigrationVersionConverter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.

Additional info

There are additional warnings when the Spring Cloud Load Balancer is being added and the root cause seems related. But this may be out of scope for this project.

Comment From: snicoll

Thanks for the report, I can reproduce as described.

Comment From: snicoll

This is a regression that has been introduced by #43886

Comment From: hpoettker

Thanks for the very quick fix!

With the new snapshots, also the warnings that were logged for the Spring Cloud Load Balancer, which I mentioned above, are resolved.