spring.freemarker.cache:false
spring.datasource.url=jdbc:mysql://localhost/mydb
spring.datasource.username=user
spring.datasource.password=pass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
即使定义了驱动程序类名,我也会收到此错误
java.lang.IllegalStateException:无法加载驱动程序类:com.mysql.jdbc.Driver at org.springframework.util.Assert.state(Assert.java:392) ~[spring-core-4.2.1.RELEASE.jar:4.2 .1.RELEASE] 在 org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.getDriverClassName(DataSourceProperties.java:153) ~[spring-boot-autoconfigure-1.3.0.M5.jar:1.3.0.M5] 在 org .springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration.dataSource(DataSourceAutoConfiguration.java:119) ~[spring-boot-autoconfigure-1.3.0.M5.jar:1.3.0.M5] 在 sun.reflect.NativeMethodAccessorImpl。 invoke0(Native Method) ~[na:1.8.0_60] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60] at ……
它继续
原文由 voidcurser 发布,翻译遵循 CC BY-SA 4.0 许可协议
如果您使用的是 Maven,请将其添加到您的
pom.xml
:(推荐)对于
MySQL 5.6, 5.7, 8.x
和Java >= 8
使用;(旧版)对于
MySQL <= 5.5
或Java <= 7
或JDBC < 4.2
使用;有关连接器/J 版本的更多详细信息