解决The dependencies of some of the beans in the application context form a cycle

The dependencies of some of the beans in the application context form a cycle

应用程序上下文中某些 Bean 的依赖关系形成一个循环

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

不鼓励依赖循环引用,默认情况下禁止使用循环引用。更新应用程序以删除 Bean 之间的依赖循环。作为最后的手段,可以通过将spring.main.allow-circular-references设置为true来自动打破循环。

解决方法

设置配置文件spring.main.allow-circular-references = true