我正在使用 MySQL 數(shù)據(jù)庫開發(fā)一個 Spring Boot 項目。如果我運(yùn)行我的代碼,一個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貢獻(xiàn)1804條經(jīng)驗 獲得超7個贊
將屬性更改spring.datasource.jdbc-url
為
spring.datasource.url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false

HUH函數(shù)
TA貢獻(xiàn)1836條經(jīng)驗 獲得超4個贊
應(yīng)用程序?qū)傩?code>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
提交
取消