启动项目报错
来源:6-4 实例1-DB-DB
慕圣502602
2019-08-14
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userJdbcTemplate’ defined in class path resource [com/imooc/example/springdtxdbdb/service/DBConfiguration.class]: Unsatisfied dependency expressed through method ‘userJdbcTemplate’ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userDataSource’ defined in class path resource [com/imooc/example/springdtxdbdb/service/DBConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker’: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ‘org.springframework.boot.autoconfigure.jdbc.DataSourceProperties’ available: more than one ‘primary’ bean found among candidates: [userDataSourceProperties, orderDataSourceProperties, spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties]
1回答
-
大漠风
2019-08-19
通过错误,可以看出,是配置了2个DataSourceProperties,但是好像没有设置"@Primary"。
可以贴你的config的配置类,看一下是哪里有问题。
00
相似问题