开发者社区> 问答> 正文

spring boot启动报错org.springframework.beans?400报错

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [F:\WorkSpace\spring-boot-shardingjdbc\target\classes\com\example\demo\mapper\UserInfoMapper.class]: Cannot resolve reference to bean 'testSqlSessionTemplate' while setting bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'testSqlSessionTemplate' defined in class path resource [com/example/demo/config/DataSourceConfig.class]: Unsatisfied dependency expressed through method 'testSqlSessionTemplate' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/example/demo/config/DataSourceConfig.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardingDataSource' defined in class path resource [com/example/demo/config/DataSourceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getShardingDataSource' threw exception; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unknown database 'user')

 

 

 

实在是不知道问题出在哪里,网上查了跟多有的说是依赖冲突,也有说是启动类使用

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}),不加载热启动也试过,都没用  这是我配置错了吗

展开
收起
爱吃鱼的程序员 2020-06-06 15:38:17 1613 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>问题不是最后一句么。。。。</p>
    

    Cannot create PoolableConnectionFactory (Unknown database 'user')

    2020-06-06 15:38:29
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Boot 2.6.0电商网站开发实战 立即下载
电商网站需求分析和架构设计Spring Boot2.6入门 立即下载
云上Docker的Spring Cloud微服务应用实践分享 立即下载

相关实验场景

更多