I'm using Spring Boot 2.2.6.

It works well with the follow config about hikari pooling datasource.

spring.datasource.url=url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=****
spring.datasource.password=****

I think the other config should work well too, but it didn't.

spring.datasource.hikari.jdbc-url=url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8
spring.datasource.hikari.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.hikari.username=****
spring.datasource.hikari.password=****

The error info is here.

SpringBoot how to use 'spring.datasource.hikari.jdbc-url' and 'spring.datasource.hikari.driver-class-name'?

If i remove the 'hikari' like this, every thing is ok. So it confused me how to use these properties, 'spring.datasource.hikari.jdbc-url' and 'spring.datasource.hikari.driver-class-name'. I cannot get any explicit explanation from the doucument.

spring.datasource.url=url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.hikari.username=****
spring.datasource.hikari.password=****

Comment From: snicoll

DataSourceBuilder is the component that will map url to jdbc-url if necessary as explained in the documentation.

If you have further questions, please follow up on StackOverflow, as mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Comment From: snicoll

@wilkinsona mentioned to me that the use case I have in mind is not what you're actually doing. Let's reopen for further consideration.

Comment From: snicoll

@chace0120 I don't understand what you're doing and how you ended up with that error. I don't understand either why you use the hikari specific properties where Spring Boot adavertizes auto-configuration with "spring.datasource.url" and the like.

Can you please share a small sample (zip or link to a repo) that we can run ourselves to get the stacktrace in your screenshot?

Comment From: tccoca

I saw the two properties in the spring boot document - "common-application-properties".Because i used the hikari by Spring Boot auto-configuration, so i thought that maybe the two specific properties could replace the "spring.datasource.url" and "spring.datasource.driver-class-name".

SpringBoot how to use 'spring.datasource.hikari.jdbc-url' and 'spring.datasource.hikari.driver-class-name'?

Then i tried and failed, so i submitted this issue. I just want to know when to use "spring.datasource.hikari.jdbc-url" and "spring.datasource.hikari.driver-class-name" listed in the doucument.

Comment From: snicoll

@chace0120 We expose all properties of the DataSource so that you can customize advanced options. Basic settings such as driver and URL are configured by the auto-configuration and the spring.datasource namespace.

With the configuration above, here is the failure you get:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

Unfortunately, we can states "spring.datasource.url" in there as another prefix can be used if you have a custom setup.

The documentation states the following:

You should at least specify the URL by setting the spring.datasource.url property.

When I do that, the error goes away. Sorry but I don't think there's much else we can do here. If you want Spring Boot to auto-configure the datasource, the documentation mentions already you have to configure spring.datasource.url.

Comment From: labbRS

spring.datasource.hikari.jdbc-url=jdbc:postgresql://172.18.17.134:9532/efrm_norm_uat?currentSchema=npci_efrm spring.datasource.hikari.username=efrm spring.datasource.hikari.password=admin123

option#1 spring.datasource.url=jdbc:postgresql:

option#2 spring.datasource.url=x spring.datasource.driverClassName=org.postgresql.Driver