I'm trying to make a database connection in a small spring boot app using the following Hikari configs.
spring:
datasource:
hikari:
idle-timeout: 60000
maximum-pool-size: 50
minimum-idle: 5
connection-test-query: SELECT 1
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
validation-timeout: 500
register-mbeans: true
jdbc-url: jdbc:sqlserver://URL_HERE
username: FAKE_USERNAME
password: FAKE_PASSWORD
Then i get a error : Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
But when i add the following with the above hikari configs the app starts up fine. I'm not sure but i think it should not depend on the below url and just use the hikari one if its specified there.
spring:
datasource:
url: jdbc:sqlserver://URL_HERE
Comment From: snicoll
Thanks for the report. Unfortunately, that's not how this works. spring.datasource.hikari.*
(as well as spring.datasource.tomcat.*
and spring.datasource.dbcp2.*
) are used to provide additional, connection pools-specific options.
The auto-configuration requires that basic settings are provided via spring.datasource.*
. This also makes sure that your DataSource
can be configured if another connection pool is on the classpath.