今天做初始化数据库,报一下异常
***************************
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内容请搜索靠谱客的其他文章。
发表评论 取消回复