add r2dbc spring data to support reactive datasource

This commit is contained in:
Antoine 2020-08-16 01:09:36 +02:00
parent 8b6fc42ce9
commit f5265becec
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
3 changed files with 24 additions and 0 deletions

View File

@ -14,3 +14,4 @@ docker-build:
docker-run:
docker run --rm -d -p 8080:8080 docker.registry:5000/wikiproject:latest

View File

@ -55,6 +55,14 @@
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-h2</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,15 @@
package tk.antoine_roux.wiki.configuration;
import io.r2dbc.spi.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.r2dbc.core.DatabaseClient;
@Configuration
public class DatabaseConfiguration {
@Bean
public DatabaseClient getDatabase(ConnectionFactory connectionFactory) {
return DatabaseClient.create(connectionFactory);
}
}