-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Log URLs for all DataSources when H2 Console is auto-configured #27881
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
Comments
Thanks for the suggestion. H2's console isn't limited to H2 databases so, if it's only going to log the connection info for one DataSource, I think it makes sense for it to be the one that's primary. We could consider logging the connection details for every |
Yeah, I think a log along those lines could be useful. I need to be constantly reminded that the H2 console works also with another database (it's just counter intuitive for me). |
This has come up in the past but I don't think an issue was ever raised for it. |
Closing in favor of PR #28204 |
I'm using two datasources (Oracle + h2) in my spring boot project. I configure them manually in my configuration class, and the Oracle Datasource is annotated with Primary. When my project starts, the H2ConsoleAutoConfiguration prints out its log:
o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:oracle:thin:@xxx'
I replace my oracle ip and sid with xxx.
The expected behavior is H2ConsoleAutoConfiguration should print jdbc:h2:mem:xxx instead of jdbc:oracle:thin.
I delve into H2ConsoleAutoConfiguration.java and find the following code:
Is it better to check the connection URL starts with jdbc:h2 such that the log can print the correct h2 database connection?
Spring Boot version: 2.4.5
my sample project:
multi-datasource.zip
The text was updated successfully, but these errors were encountered: