理工大学的菜鸡 2022-08-23 17:46 采纳率: 84.2%
浏览 46
已结题

整合druid连接池报错

问题遇到的现象和发生背景

整合druid连接池报错

问题相关代码,请勿粘贴截图
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘dataSource’: Unsatisfied dependency expressed through field ‘basicProperties’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties’: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/ConnectionCallback
  • 写回答

4条回答 默认 最新

  • CSDN专家-sinJack 2022-08-23 17:50
    关注

    UnsatisfiedDependencyException: Error creating bean with name ‘dataSource’:
    依赖问题,看下是否存在依赖冲突或者版本不一致问题。
    spring项目:

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
         <version>1.2.9</version>
    </dependency>
    

    springboot项目:

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid-spring-boot-starter</artifactId>
        <version>1.1.14</version>
    </dependency>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 8月31日
  • 已采纳回答 8月23日
  • 创建了问题 8月23日