The dependencies of some of the beans in the application context form a cycle: articleController (field com.dxh.blog.service.ArticleService com.dxh.blog.dao.controller.ArticleController.articleService) ↓ articleServiceImpl (field private com.dxh.blog.service.SysUserService com.dxh.blog.service.impl.ArticleServiceImpl.sysUserService)┌─────┐| sysUserServiceImpl (field com.dxh.blog.service.LoginService com.dxh.blog.service.impl.SysUserServiceImpl.loginService)↑ ↓| loginServiceImpl (field private com.dxh.blog.service.SysUserService com.dxh.blog.service.impl.LoginServiceImpl.sysUserService)└─────┘
引用情况如下
解决方法 :在双方对象@Autowired的基础上 都加上@Lazy注解