The dependencies of some of the beans in the application context form a cycle:
出現這種問題,如果你用其他方法怎么都處理不掉,可以使用最后的方法:
解決方案:
在配置文件增添一行配置即可:
properties 配置文件
spring.main.allow-circular-references=true
yml 配置文件
spring:main:allow-circular-references:true
除非你引入一個jar包導致的循環依賴,其他的循環依賴不建議你使用該方法。