Spring Boot 报错:“jdbcUrl is required with driverClassName.”
问题:
Spring Boot 升级到2.0之后,配置多数据源的时候报错:
“jdbcUrl is required with driverClassName.”或者Cause: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required.] with root cause
解决办法如下:
Spring Boot 1.0 配置数据源,写成:spring.datasource.url 和spring.datasource.driverClassName。
Spring Boot 2.0 需要变更成:spring.datasource.jdbc-url和spring.datasource.driver-class-name
注意:使用Spring Boot 2.0 默认数据源,配置如下spring.datasource.url和spring.datasource.driver-class-name。