Skip to content

Spring-boot 1, warning about bean creation - CacheOrGroupedOpenApiCondition #689

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

Closed
lrozenblyum opened this issue May 26, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@lrozenblyum
Copy link

Describe the bug
The logs of start-up contain a warning

ConfigurationClassEnhancer - @Bean method SpringDocConfiguration.springdocBeanFactoryPostProcessor2 is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details.

To Reproduce
Spring Boot OpenApi 1.3.9
Spring Boot 1.5.13.RELEASE
Boot the app.

Expected behavior

  • No warnings in logs due to beans definitions
@bnasslahsen
Copy link
Collaborator

bnasslahsen commented May 26, 2020

@lrozenblyum,

Seems you have disabled the cache for your case: you didn't mention that
Anyway, fixed.

@bnasslahsen bnasslahsen changed the title Spring warning about bean creation Spring-boot 1, warning about bean creation - cache disabled May 26, 2020
@lrozenblyum
Copy link
Author

lrozenblyum commented May 27, 2020

Thank you @bnasslahsen. Sorry for late response.
It looks like I haven't disabled the cache (at least not explicitly).
I'll double check my configuration.
(NOTE: I'm starting Spring Boot in a Spring MVC project manually similarly to what was described in
https://springdoc.org/faq.html 'How to Integrate Open API 3 with Spring project (not Spring Boot)?')

@bnasslahsen
Copy link
Collaborator

Or maybe you enabled the groups?

@lrozenblyum
Copy link
Author

Yes, groups are enabled!

@bnasslahsen
Copy link
Collaborator

Yeah, this explains the reason: BeanFactoryPostProcessor is enabled if CacheOrGroupedOpenApiCondition is met.

@bnasslahsen bnasslahsen changed the title Spring-boot 1, warning about bean creation - cache disabled Spring-boot 1, warning about bean creation - CacheOrGroupedOpenApiCondition May 27, 2020
@lrozenblyum
Copy link
Author

lrozenblyum commented May 27, 2020

Then it's clear. Thanks for fixing @bnasslahsen

@bnasslahsen bnasslahsen added the bug Something isn't working label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants