- You have to add following dependency to your
pom.yml
:
<dependency>
<groupId>de.adorsys.sts</groupId>
<artifactId>sts-persistence-jpa</artifactId>
</dependency>
- To use the JPA-Repository to save your keystore, you have to add the
@EnableJpaPersistence
annotation to your spring configuration class.
By default this package will provide an embedded h2-database you do not need to configure.
-
Make sure your postgres-instance is running and adjust the datasource-properties in the
application-postgres.yml
. -
Use the
postgres
spring profile with following command-line-argument:
--spring.profiles.active=postgres
Note: Spring provides alternative ways to set profiles.
-
Make sure your mysql-instance is running and adjust the datasource-properties in the
application-postgres.yml
. -
Use the
mysql
spring profile with following command-line-argument:
--spring.profiles.active=mysql
Note: Spring provides alternative ways to set profiles.
- Use the
h2
spring profile with following command-line-argument:
--spring.profiles.active=h2
Note: Spring provides alternative ways to set profiles.
Your h2-database files will be stored as sts_h2_db.mv.db
and sts_h2_db.trace.db
as default.
Connectors for h2, postgres and mysql are using the datasource-properties:
spring:
datasource:
url: <database connection url - consider documentation of your selected database - default: h2 in-memory>
username: <database username - default: db_user>
password: <database password - default: db_user@123>
You can use flyway or liquibase for database-migration. Migration files for both ways are existing in this project.
liquibase will be used as default migration tool.
- Use the
liquibase
spring profile with following command-line-argument:
--spring.profiles.active=liquibase
Note: Spring provides alternative ways to set profiles.
Alternatively you can copy the migration scripts to your resource
-folder.
Do not forget to adjust the paths to your migration scripts in your application.yml
:
liquibase:
change-log: classpath:/db/migration/changelog.yml
- Use the
flyway
spring profile with following command-line-argument:
--spring.profiles.active=flyway
Note: Spring provides alternative ways to set profiles.
Like for liquibase you can copy the migration scripts to your resource
-folder.
You need to adjust your application.yml
. Make sure you use the correct migration files for your database type:
For h2:
flyway:
locations:
- db/migration/flyway/h2
For postgres:
flyway:
locations:
- db/migration/flyway/postgres
For mysql:
flyway:
locations:
- db/migration/flyway/mysql