我正在使用 MySQL 数据库开发一个 Spring Boot 项目。如果我运行我的代码,一个WrongArgumentException说法是databaseURL cannot be null.application.properties:spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource.jdbc-url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=falsespring.datasource.username=rootspring.datasource.password=****##Mapper Config##mybatis.type-aliases-package=com.springboot.reservingmybatis.mapper-locations=mapper/**/*.xmlspring.devtools.livereload.enabled =truespring.freemarker.cache=false错误信息:java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: The database URL cannot be null.
2 回答
三国纷争
TA贡献1804条经验 获得超7个赞
将属性更改spring.datasource.jdbc-url
为
spring.datasource.url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false
HUH函数
TA贡献1836条经验 获得超4个赞
应用程序属性spring.datasource.jdbc-url
中没有命名的属性
改变
spring.datasource.jdbc-url
到
spring.datasource.url
spring.datasource.platform=mysql
spring.datasource.url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=****
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
添加回答
举报
0/150
提交
取消