Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Datasource configuration issue after spring boot 2 migration (Hiraki jdbcUrl is required.) #12758
We have an spring boot application with multiple datasources, configured in properties with different namespaces as:
After switching to Spring boot 2 with the new Hikari default connection pool there is an error in the start up of the application.
After checking documentation it seems that for Hikari connection pool is not neccesary include the driver class name (Maybe including this the refence guide? boot-app-properties ) so we have removed and we get a different error:
The problem it seems that with a different namespace in the properties than the default one, the org.springframework.boot.jdbc.DataSourceBuilder is not mapping correctly the standard spring url property to the native hiraki jdbcURL.
This works as workaround (I don´t want to remove the spring standard):
That's not how you should configure custom datasources if you want to simulate what the auto-configuration does. There is a dedicated section in the documentation that shows you how to accomplish this.
If you use the technique explained in the documentation, you could also omit the jdbc driver as it is automatically detected.
Many thanks for the clarification. One question en relation with the documentation referenced.
If the datasource can be initialized with a DataSourceProperties bean previously initialized with the @ConfigurationProperties.
Why is it necessary to include the same @ConfigurationProperties in the datasource bean?