ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.91k stars 522 forks source link

Cannot enhance @Configuration bean definition 'beanNamePlaceholderRegistryPostProcessor' #45

Closed ChrisMacpherson closed 7 years ago

ChrisMacpherson commented 7 years ago

Hi,

I've just been debugging why I get this warning in the logs. It happens as soon as I add Jasypt to my POM file in a SpringBoot 1.5.2 app. I tried changing to Spring Boot 1.5.1 too as I noticed it was mentioned as fixed in another ticket (#16), but it still appears. Actually that was slightly different but could ignore the warning in a similar fashion.

WARN [main] ConfigurationClassPostProcessor: Cannot enhance @Configuration bean definition 'beanNamePlaceholderRegistryPostProcessor' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.

I can get logback to ignore it, as is also mentioned in the other ticket, but as it was marked as fixed I thought I would raise it again.

ulisesbocchio commented 7 years ago

Yeah, The method is in fact static as the warning suggests. When non static you get the same warning. My guess is that Spring heuristics for that warning are buggy. I did debug Spring's code to see when it was being logged and surprisingly enough the bean was being processed twice, on the first pass it was OK and on the second pass it was logging the warning. Not sure why, but you can rest assured, it has no side effects for the bean since it doesn't use any of the limitations implied by declaring a non-static registry post processor.

ChrisMacpherson commented 7 years ago

Thanks for the super fast reply! Okay I'll just ignore it for now.

ulisesbocchio commented 7 years ago

yeah, no worries :)