我是靠谱客的博主 忐忑奇迹,最近开发中收集的这篇文章主要介绍SpringBoot2 初始数据库循环依赖 The dependencies of some of the beans in the application context form a cycle,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

今天做初始化数据库,报一下异常



***************************
APPLICATION FAILED TO START
***************************

Description:

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

   userServiceImpl (field com.rude.springboot2.demo.dao.UserDao com.rude.springboot2.demo.service.impl.UserServiceImpl.userDao)
      ↓
   userDao defined in file [D:JavaideaIUworkspacestudyspringboot2demotargetclassescomrudespringboot2demodaoUserDao.class]
┌─────┐
|  sqlManagerFactoryBean defined in class path resource [com/ibeetl/starter/BeetlSqlSingleConfig.class]
↑     ↓
|  beetlSqlDataSource defined in class path resource [com/ibeetl/starter/BeetlSqlSingleConfig.class]
↑     ↓
|  dataSource defined in class path resource [com/rude/springboot2/demo/config/BeetlSqlConfiguration.class]
↑     ↓
|  org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
└─────┘
 


这就尴尬了,查了一天,还看了源代码,一天没吃饭了,中午查出来了。

解决方法,将代码下列代码添加    exclude = DataSourceAutoConfiguration.class

@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

为:

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

问题解决,好了,不说了,简单的记录下,吃饭去了,都是泪啊!!!

最后

以上就是忐忑奇迹为你收集整理的SpringBoot2 初始数据库循环依赖 The dependencies of some of the beans in the application context form a cycle的全部内容,希望文章能够帮你解决SpringBoot2 初始数据库循环依赖 The dependencies of some of the beans in the application context form a cycle所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部