spring-cloud-config: ConfigurationClassPostProcessor cannot enhance bean "refreshScope"

WARN [org.springframework.context.annotation.ConfigurationClassPostProcessor] - 
<Cannot enhance @Configuration bean definition 'refreshScope' 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'.>

Seeing this with Spring 2.4.6. Recently upgraded from 1.0.4.RELEASE where this warning was non-apparent. Is this something to be concerned about?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

In our App which i would subsume under “sufficiently complex”, this is the ONLY warning that is logged during startup. Besides that you are right, the original question was a little bit different. Nevertheless i think it is a bad practice having WARN’s logged out that ought to be ignored. And finally there might be a reason why the Spring people introduced it and it might indicate improper usage.

Turns out this isnt quite solved: I removed all traces of @RefreshScope from all @Configuration classes, and ran a global search to ensure. I still see the log warning message.

Getting an App completely WARN-free is common practice in our organisation because we have a WARNINGS histogram chart on our DevOps monitor. We want this chart to be free of “noise” so that we can see when anything really goes wrong. Therefore regular warnings or errors that get logged every so often are very annoying for us. I think this bug should be reopened.