Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/touk/dockds
Docker contained database autoconfiguration for Spring Boot
https://github.com/touk/dockds
embedded-database embedded-mysql embedded-postgresql jpa mysql postgresql spring-boot
Last synced: 3 days ago
JSON representation
Docker contained database autoconfiguration for Spring Boot
- Host: GitHub
- URL: https://github.com/touk/dockds
- Owner: TouK
- Created: 2016-10-24T09:21:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-26T09:56:53.000Z (over 4 years ago)
- Last Synced: 2023-07-07T14:15:41.631Z (over 1 year ago)
- Topics: embedded-database, embedded-mysql, embedded-postgresql, jpa, mysql, postgresql, spring-boot
- Language: Java
- Homepage:
- Size: 23.4 KB
- Stars: 11
- Watchers: 13
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dockds
[![Build Status](https://travis-ci.org/TouK/dockds.svg?branch=master)](https://travis-ci.org/TouK/dockds)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:
```xmlpl.touk
dockds
1.2.0
```
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](https://spring.io/guides/gs/accessing-data-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)