Spring Boot整合Mybatis出现错误java.lang.IllegalStateException: Cannot load driver class:com.mysql.cj.jdbc.Driver

错误描述:

Caused by: java.lang.IllegalStateException: Cannot load driver class: com.mysql.cj.jdbc.Driver
	at org.springframework.util.Assert.state(Assert.java:94) ~[spring-core-5.1.10.RELEASE.jar:5.1.10.RELEASE]

错误原因及解决办法:

可能是没有加入驱动的依赖jar包,检查pom.xml中是否有对应依赖,没有则加入依赖

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
</dependency>
posted on 2019-10-23 15:51  行之间  阅读(5772)  评论(0编辑  收藏  举报