I went back to programming my old program https://github.com/JonkiPro/REST-Web-Services. I\'ve updated Spring Boot from version 15.6 to version 2.0.0. I have encountered many pr
I had the same issue in another context. From the 79. Data Access - Configure a Custom DataSource
if you happen to have Hikari on the classpath, this basic setup does not work, because Hikari has no url property (but does have a jdbcUrl property)
Hikari is the default pool in spring boot 2.
so you can replace the config
url: jdbc:postgresql:database
-> jdbc-url: jdbc:postgresql:database
or you can keep the config but you need to define another Bean to handle the mapping (aliases)
@Bean
@Primary
@ConfigurationProperties("app.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
}
@Bean
@ConfigurationProperties("app.datasource")
public DataSource dataSource(DataSourceProperties properties) {
return properties.initializeDataSourceBuilder().
.build();
}
Either remove spring.datasource.driver-class-name
property or rename the spring.datasource.url
property to spring.datasource.jdbc-url
.
This is reported in your error:
java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName
First option looks cleaner and Spring Boot will figure out the default driver class name based on the spring.datasource.url
property value (see org.springframework.boot.jdbc.DatabaseDriver
class if you want to debug this).