1、描述

正在愉快的写代码,突然报错

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

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.

截图
在这里插入图片描述
根据报错我们很容易就可以理解了,是由于我在userService和EchoSerice两个类里循环引用了对方,找到问题所在就好解决了,我去把userService里注入的echoService去掉,问题解决!

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐