-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Change of behaviour in the beans loading order #1965
Comments
You are welcome to propose a Pr with the related unit tests for this enhancement |
…ry-configurer Prevents premature initialisation of factory-beans. Fixes #1965
@bnasslahsen Is there a release date for the new 1.6.x version? This is a very important version for us. Thank you very much and sorry for the inconvenience |
Not yet planned. When you say this is very important for us. |
Hi @bnasslahsen We have a Spring-boot based framework that uses OpenApi contracts and we support SpringDoc to use it. |
Describe the bug
Hello
I wanted to tell you about the problem I am having. The problem is unusual and will not happen easily.
The BeanFactoryPostProcessors SpringdocBeanFactoryConfigurer and SpringdocActuatorBeanFactoryConfigurer are causing a change in the loading order in an application I have with springdoc and spring-cloud-stream when there is a pollable and it is causing an error.
ConfigurableListableBeanFactory#getBeanNamesForType(Class) method is causing factorybeans to be initialised.
springdoc-openapi/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringdocBeanFactoryConfigurer.java
Lines 60 to 64 in b274a0e
Internally this call is being made:
And according to the javadoc of ListableBeanFactory, the third parameter can cause dangerous behaviour.
In my case, BindableFunctionProxyFactory (implements FactoryBean) is being initialised early and internally doing
. But as it is initialised early, it will not load all the beans it should. That is, the FactoryBean is created without guaranteeing that all the beans have already been created.
To Reproduce
Steps to reproduce the behavior:
Solution
This problem can easily be solved in the following way
In SpringdocBeanFactoryConfigurer class, get beans by type with allowEagerInit flag set to false
In fact, I can make a contribution if you like.
The text was updated successfully, but these errors were encountered: