SpringBoot:循环引用解决方式
1 前言
SpringBoot启动时提示循环引用:
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.
it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.,即可以通过将spring.main.allow-circular-references设置为true来自动中断循环。
2 使用
解决方式即在application.properties配置文件下,增加如下配置即可:
spring.main.allow-circular-references = true