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:\Java\ideaIU\workspace\study\springboot2\demo\target\classes\com\rude\springboot2\demo\dao\UserDao.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);
    }
}

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值