今天学习SpringBoot整合jetCache,运行程序时,报了个循环依赖的bug,找了好久,才找到解决方法,跟大家分享一下。具体报错如下
Action:
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.
看了网上很多大神的办法,不是很复杂就是看不懂,诶,没办法,最后发现,只需要在我们的核心配置文件yml文件中添加如下配置就可以解决
spring:
main:
allow-circular-references: true
如果你也报了相同的循环依赖的问题,不妨试一下,成功的话别忘记回来点个赞。