add r2dbc spring data to support reactive datasource
This commit is contained in:
parent
8b6fc42ce9
commit
f5265becec
1
Makefile
1
Makefile
@ -14,3 +14,4 @@ docker-build:
|
||||
|
||||
docker-run:
|
||||
docker run --rm -d -p 8080:8080 docker.registry:5000/wikiproject:latest
|
||||
|
||||
|
8
pom.xml
8
pom.xml
@ -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>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user