我有这个异常(exception):
SEVERE: Context initialization failedorg.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'myService': Bean with name 'myService' has been injected into other beans [otherService] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
谁能提出找到循环依赖来源的好策略?
我目前正在查看上下文定义,但正如您可能想象的那样,在某个成熟的项目中这需要相当长的时间。
所以我通常在寻找有关快速查找循环 bean 依赖项的想法。
最佳答案
这里有 2 个宣传依赖图生成的工具。然而,我对它们没有任何经验。
- SpringSource's build of Eclipse - 它宣传“Spring Bean 依赖图”
- MyEclipse for Spring - 说“bean 依赖图”
关于java - 查找 spring bean 之间循环依赖的良好实践,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8402140/