-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Support configuration of connection URL via EmbeddedDatabaseBuilder [SPR-16619] #21160
Comments
EmbeddedDatabaseBuilder
[SPR-16619]
I can see how I don't really see why this has to be so private to be honest. We'd have to spike before opening things a little. @wilkinsona is there anything particular that Spring Boot could use when a connection pool is not available? Or perhaps something that would make it common with the connection pool use case? |
It's hard to say with any certainty because, as far as I can remember, no one's asked for Boot's purely embedded (no connection pool) case to be more configurable. That may well be due to a connection pool being on the classpath the vast majority of the time. The URLs in Boot's |
Thanks Andy. I did try something which gives some flexibility to call the configurer with whatever arguments we want and tune things after if necessary, see snicoll@f52ac3a This can be used as follows: this.factory.setDatabaseConfigurer(EmbeddedDatabaseConfigurers.customizeConfigurer(
EmbeddedDatabaseType.H2, defaultConfigurer ->
new EmbeddedDatabaseConfigurerDelegate(defaultConfigurer) {
@Override
public void configureConnectionProperties(ConnectionProperties properties, String databaseName) {
super.configureConnectionProperties(properties, "custom-db-name");
}
})); |
This commit allows EmbeddedDatabaseConfigurer instances to be further customized if necessary. EmbeddedDatabaseBuilder has a way now to set a DatabaseConfigurer rather than just a type to provide full control, or customize an existing supported database type using the new EmbeddedDatabaseConfigurers#customizeConfigurer callback. Closes spring-projectsgh-21160
EmbeddedDatabaseBuilder
[SPR-16619]
Dan Lipofsky opened SPR-16619 and commented
H2EmbeddedDatabaseConfigurer
is not public. So I can't extend it, and even if I couldEmbeddedDatabaseBuilder
does not have a pass-through method to set the configurer on the underlyingEmbeddedDatabaseFactory
.All I really want to do is change the URL flags in
H2EmbeddedDatabaseConfigurer
but there is no way to do it.Please please add a pass-through method to the builder to set the configurer on the factory and also make the existing configurers public.
Affects: 4.3.13, 5.0.4
The text was updated successfully, but these errors were encountered: