dockds

Docker contained database autoconfiguration for Spring Boot

License

License

GroupId

GroupId

pl.touk
ArtifactId

ArtifactId

dockds
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

dockds
Docker contained database autoconfiguration for Spring Boot
Project Organization

Project Organization

TouK
Source Code Management

Source Code Management

https://github.com/TouK/dockds

Download dockds

How to add to project

<!-- https://jarcasting.com/artifacts/pl.touk/dockds/ -->
<dependency>
    <groupId>pl.touk</groupId>
    <artifactId>dockds</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/pl.touk/dockds/
implementation 'pl.touk:dockds:1.1.0'
// https://jarcasting.com/artifacts/pl.touk/dockds/
implementation ("pl.touk:dockds:1.1.0")
'pl.touk:dockds:jar:1.1.0'
<dependency org="pl.touk" name="dockds" rev="1.1.0">
  <artifact name="dockds" type="jar" />
</dependency>
@Grapes(
@Grab(group='pl.touk', module='dockds', version='1.1.0')
)
libraryDependencies += "pl.touk" % "dockds" % "1.1.0"
[pl.touk/dockds "1.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-jdbc jar 1.5.4.RELEASE
com.spotify : docker-client jar 8.7.3
org.springframework : spring-web jar

provided (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 1.5.4.RELEASE

test (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-data-jpa jar 1.5.4.RELEASE
org.projectlombok : lombok jar 1.16.16
org.assertj : assertj-core jar 3.8.0
org.postgresql : postgresql jar 42.1.1
mysql : mysql-connector-java jar 5.1.42

Project Modules

There are no modules declared in this project.

dockds

Build Status

With a little help of Docker embed PostgreSQL or MySQL in your Spring Boot application or test just as you can do with H2 or HSQLDB.

Usage

Assuming you have either PostgreSQL or MySQL driver in your depedencies list, just add yet the following dependency:

<dependency>
  <groupId>pl.touk</groupId>
  <artifactId>dockds</artifactId>
  <version>1.2.0</version>
  <!-- Probably in most cases you will want -->
  <!-- <scope>test</scope> -->
</dependency>

Unless you have a datasource url specifified in application.properties a database instance in a Docker container will be launched along with your applicaton context.

Just as if you had an embedded database (e.g. HSQLDB) driver in your pom.xml.

If you have tests using an embedded database with @DataJpaTest annotation, you substitute it with @DockerizedDataJpaTest. This way you will be able to use native queries in your JPA repositories.

Getting Started

  1. Complete guide Accessing Data with JPA
  2. Add the above dependency to pom.xml or build.gradle
  3. Replace H2 with PostgreSQL or MySQL in the pom.xml or build.gradle
  4. Replace @DataJpaTest with @DockerizedDataJpaTest in CustomerRepositoryTests (which is not described in the guide but is available in the provided source repository)
pl.touk

TouK

We’re a software house based in Warsaw. We deliver custom IT systems.

Versions

Version
1.1.0
1.0.0
1.0.0-RC4
1.0.0-RC3