错误消息是什么“ com.mysql.cj.exceptions.WrongArgumentException:数据库URL不能为空”。意思?

时间:2019-07-28 12:54:13

标签: java mysql maven spring-boot

我正在使用MySQL数据库进行Spring Boot项目。如果我运行代码,则WrongArgumentException表示databaseURL cannot be null

application.properties:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.jdbc-url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=****

##Mapper Config##
mybatis.type-aliases-package=com.springboot.reserving
mybatis.mapper-locations=mapper/**/*.xml

spring.devtools.livereload.enabled =true

spring.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 个答案:

答案 0 :(得分:0)

将属性spring.datasource.jdbc-url更改为

spring.datasource.url=jdbc:mysql//localhost:3306/reserving?autoReconnect=true&useSSL=false

答案 1 :(得分:0)

application-properties中没有名为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