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

╰+攻爆jí腚メ 2023-06-08 13:59 136阅读 0赞

SpringBoot多数据源启动项目报错:

  1. ***************************
  2. APPLICATION FAILED TO START
  3. ***************************
  4. Description:
  5. The dependencies of some of the beans in the application context form a cycle:
  6. sysJobController (field private com.comet.service.ISysJobService com.comet.controller.SysJobController.sysJobService)
  7. sysJobServiceImpl (field private com.comet.mapper.SysJobMapper com.comet.service.impl.SysJobServiceImpl.sysJobMapper)
  8. sysJobMapper defined in file [G:\IdeaProject\comet\comet-quartz\target\classes\com\comet\mapper\SysJobMapper.class]
  9. sqlSessionFactory defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]
  10. ┌─────┐
  11. | dynamicDataSource defined in class path resource [com/comet/config/DataSourceConfig.class]
  12. | masterDataSource defined in class path resource [com/comet/config/DataSourceConfig.class]
  13. | org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
  14. └─────┘

解决方式:

在启动类添加

  1. (exclude = { DataSourceAutoConfiguration.class })

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwMzY5OTQ0_size_16_color_FFFFFF_t_70

发表评论

表情:
评论列表 (有 0 条评论,136人围观)

还没有评论,来说两句吧...

相关阅读