SpringJDBC报错Could not load JDBC driver class [com.mysql.cj.jdbc.Driver]

Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.cj.jdbc.Driver]

一般报错,检查pom文件/xml文件/类名。

有时候pom文件依赖都写了,但是不一定加载了,注意检查。我这里将mysql-connector-java的版本更改了一下,才加载出来。

SpringJDBC报错Could not load JDBC driver class [com.mysql.cj.jdbc.Driver]

 

上一篇:嵌套和父子类型查询2.0


下一篇:Svelte 怎样传入 props