-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Devtools restart fails with in-memory R2DBC database and SQL initialization scripts #28345
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 report. We've been here before with JDBC. We'll need to apply a similar fix for R2DBC. In the meantime, you can work around the problem by shutting down the database when the context is closed: @Bean
public DisposableBean embeddedDatabaseShutdownExecutor(ConnectionFactory connectionFactory) {
return () -> {
ConnectionFactoryUtils.getConnection(connectionFactory)
.flatMap((connection) -> Mono.from(connection.createStatement("SHUTDOWN").execute()))
.block();
};
} |
Thx, the workaround works for now. |
We don't have a great way to detect embedded r2dbc connections in 2.4 so we'll fix this in 2.5+ |
The new condition seems to fail when R2DBC isn't on the classpath:
|
Hopefully fixed by bc2bf84. |
Thanks! |
I have reached out to the r2dbc team and they redirected me here, this is the original issue: spring-projects/spring-data-r2dbc#665
When using r2dbc together with spring-boot-devtools's restart feature the R2dbcScriptDatabaseInitializer attempts to initialize the DB on every restart. This causes the following error:
The text was updated successfully, but these errors were encountered: