We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Spring中一个bean依赖于另一个bean的时候,可以通过构造器注入或setter注入,其中setter注入又可以分为单例和多例(prototype)。 1.如果是构造注入或多例模式的setter注入的时候,循环依赖是解决不了的; 2.如果是单例setter注入则可以解决掉循环依赖问题。原因在于Spring是先将Bean对象实例化之后再设置对象属性的而不是一次性将bean对象连同属性一起构造的。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Spring中一个bean依赖于另一个bean的时候,可以通过构造器注入或setter注入,其中setter注入又可以分为单例和多例(prototype)。
1.如果是构造注入或多例模式的setter注入的时候,循环依赖是解决不了的;
2.如果是单例setter注入则可以解决掉循环依赖问题。原因在于Spring是先将Bean对象实例化之后再设置对象属性的而不是一次性将bean对象连同属性一起构造的。
The text was updated successfully, but these errors were encountered: