-
Notifications
You must be signed in to change notification settings - Fork 40.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datasource configuration issue after spring boot 2 migration (Hiraki jdbcUrl is required.) #12758
Comments
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? BR |
Hi, postgresql.secondDatasource.jdbc-url=jdbc:postgresql://......... (In my case, both datasources are of postgresql but they are in different servers) |
I don't have the exact source code right now... But I think I did this in configuration class..
And then the properties duplicated with the prefix... app.datasource.com.jdbc-url=jdbc:postgresql://......... app.datasource.fin.jdbc-url=jdbc:postgresql://......... So if you need datasource @Autowired you need to add the specific qualifier... Look out if you plan to used distributed transactions that are not supported by spring by default |
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):
The text was updated successfully, but these errors were encountered: