Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigurationClassPostProcessor cannot enhance bean "refreshScope" #401

Closed
mmoayyed opened this issue May 14, 2016 · 15 comments
Closed

ConfigurationClassPostProcessor cannot enhance bean "refreshScope" #401

mmoayyed opened this issue May 14, 2016 · 15 comments
Labels

Comments

@mmoayyed
Copy link

mmoayyed commented May 14, 2016

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?

@mmoayyed
Copy link
Author

/cc @dima767

@shakuzen
Copy link
Contributor

Are you using @RefreshScope on a @Configuration class? There is a corresponding note in the documentation regarding that. See the RefreshScope section. Generally speaking, configuration classes themselves are not what you want to make refresh scope.

@mmoayyed
Copy link
Author

Thanks. It appears that there a quite a few Configuration classes that do carry that annotation. I'll get them removed.

@mmoayyed mmoayyed reopened this May 14, 2016
@mmoayyed
Copy link
Author

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.

@mmoayyed
Copy link
Author

If it helps, I am using Boot 1.3.5.RELEASE

@dsyer
Copy link
Contributor

dsyer commented May 17, 2016

I think it's fine. It's just telling you about a bean that is configured in the framework now.

@dsyer dsyer added the question label May 17, 2016
@dsyer dsyer closed this as completed May 17, 2016
@mmoayyed
Copy link
Author

Thanks for the confirmation.

Of course, would have been more reassuring if it wasnt logged as WARN, but I understand that is core to Spring and not the cloud config.

@janlisse
Copy link

janlisse commented Nov 1, 2016

Hallo @dsyer ,

i don't think it's fine having a WARN logged on every application startup. Won't you agree?

@dsyer
Copy link
Contributor

dsyer commented Nov 1, 2016

I don't think this is the only WARN log when an app starts up, once it gets to something sufficiently complex. Besides I don't think there is a way to stop this one, since it comes from Spring (not from Spring Cloud). If you see a way to stop it please open a new issue, since it is not really relevant to the original question here.

@janlisse
Copy link

janlisse commented Nov 2, 2016

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.

@dsyer
Copy link
Contributor

dsyer commented Nov 2, 2016

I suggest you take it up with the Spring team then (https://jira.spring.io/browse/SPR) and/or open a new issue here.

binkley added a commit to binkley/sproingk that referenced this issue Jan 20, 2017
Spring won't fix this.  Spring Boot won't fix this.  Dave Syer is downright
unfriendly when discussing it.  So we'll hack a workaround, and add a little
more technical debt.

See: spring-cloud/spring-cloud-config#401
@BastianVoigt
Copy link

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.

@dsyer
Copy link
Contributor

dsyer commented Mar 10, 2017

Maybe you didn't read the comment above? In my opinion this warning is completely benign, and we don't control it in Spring Cloud anyway, so calling it a "bug" is a tad incendiary, and unlikely to win you any friends. Please open an issue in the Spring JIRA if you want to dig into the technical reasons for the log.

@dsyer
Copy link
Contributor

dsyer commented Mar 10, 2017

Also, RefreshScope is in Spring Cloud Commons, so this is the wrong place to discuss changes.

@kyounger
Copy link

@BastianVoigt, you can configure the log level for that specific class to turn off logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants