Add the following dependency to your project:
<dependency>
<groupId>de.jbellmann.rwds</groupId>
<artifactId>rw-ds-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
Supports:
- Spring-Boot 2.7.x
- Spring-Boot 3.1.x
The library follows spring-boots howto configuring multiple datasources.
Configuration section respects settings for HikariCP.
rwds:
datasource:
write:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:{WRITE_PORT}/postgres
username: postgres
password: postgres
configuration: # HikariCP config options
maximum-pool-size: 5
auto-commit: false # has to be 'false' when used with hibernate
read:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:{READ_PORT}/postgres
username: postgres
password: postgres
configuration: # HikariCP config options
maximum-pool-size: 5
auto-commit: false # has to be 'false' when used with hibernate
This project provides some example applications.
- JOOQ
- Spring-Data-JPA
- with spring-boot-2 (
import javax.persistence.Entity;
) - with spring-boot-3 (
import jakarta.persistence.Entity;
)
- with spring-boot-2 (
This project uses Build Profiles to support different versions of spring-boot.
- spring-boot-2 (build against Spring-Boot version 2.7.x, active by default)
- spring-boot-3 (build against Spring-Boot version 3.0.x)
- examples (enables
examples
sub-modules to be build too)
./mvnw verify # spring-boot-2, active by default
./mvnw verify -Pspring-boot-3 # will activate spring-boot-3 profile, deactivates spring-boot-2 profile
./mvnw verify -Pspring-boot-2,examples # will activate spring-boot-2 profile, activates examples modules to be build
./mvnw verify -Pspring-boot-3,examples # will activate spring-boot-3 profile, activates examples modules to be build
examples
-modules contain integration tests spawning PostgreSQL instances in Docker via TestContainers. A working Docker installation is required to be in place.