【SpringBoot】报错:SpringBoot连接数据库时提示org.springframework.dao.DataAccessException
报错内容:SpringBoot连接数据库时提示ClassNotFoundException: org.springframework.dao.DataAccessException解决方法:依赖导入spring-boot-starter-jdbc<dependency><groupId>org.springframework.boot</groupId><
·
报错内容:
SpringBoot连接数据库时提示ClassNotFoundException: org.springframework.dao.DataAccessException
解决方法:
依赖导入spring-boot-starter-jdbc
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
而如果你用mybatis,直接用mybatis-spring-boot-starter
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
因为mybatis-spring-boot-starter已经包含了spring-boot-starter-jdbc依赖
更多推荐




所有评论(0)