Description
I followed the Spring official document to define MethodValidationPostProcessor
for bean validation. But I am triggering the below warning:
2024-05-30T17:53:41.988-04:00 WARN 74724 --- [demo] [ main] trationDelegate$BeanPostProcessorChecker : Bean 'appConfig' of type [com.example.demo.AppConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [validationPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead.
To reproduce it, see https://github.com/ozooxo/spring-jakarta-validation-post-processors-warning
- Commit #1 is solely generated by spring starter.
- Commit #2 defines the
MethodValidationPostProcessor
bean following the doc.
then if I ./gradlew bootRun
I'll see the above warning.
It seems that a similar problem has been coming up before in ~2017:
- When I use spring-boot to create an object that supports transactions, the object can not be correctly created spring-boot#9416
- AbstractMethodError when calling validated method of MethodValidationPostProcessor is using a @Lazy validator [SPR-15629] #20188
- Follow-up: AbstractMethodError when calling validated method of MethodValidationPostProcessor is using a @Lazy validator [SPR-15807] #20362
but it has been coming back.