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>