开发者社区> 问答> 正文

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 1669 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
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多