Update to core r2dbc support

This commit adapts the auto-configuration for the new core r2dbc support
in Spring Framework and provides auto-configuration for
R2dbcEntityOperations.

Closes gh-22708
This commit is contained in:
Stephane Nicoll
2020-08-03 18:25:13 +02:00
parent 2b995324e4
commit 36fb86a110
18 changed files with 154 additions and 46 deletions

View File

@@ -23,7 +23,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.data.r2dbc.connectionfactory.init.ResourceDatabasePopulator;
import org.springframework.r2dbc.connection.init.ResourceDatabasePopulator;
/**
* Example configuration for initializing a database using R2DBC.
@@ -41,7 +41,7 @@ public class R2dbcDatabaseInitializationExample {
ResourceLoader resourceLoader = new DefaultResourceLoader();
Resource[] scripts = new Resource[] { resourceLoader.getResource("classpath:schema.sql"),
resourceLoader.getResource("classpath:data.sql") };
new ResourceDatabasePopulator(scripts).execute(connectionFactory).block();
new ResourceDatabasePopulator(scripts).populate(connectionFactory).block();
}
}