The dependencies of some of the beans in the application context form a cycle 解决方案

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)
└─────┘

引用情况如下
The dependencies of some of the beans in the application context form a cycle 解决方案_第1张图片
The dependencies of some of the beans in the application context form a cycle 解决方案_第2张图片

解决方法 :在双方对象@Autowired的基础上 都加上@Lazy注解

你可能感兴趣的:(笔记,java,spring,spring,boot,intellij-idea)