Skip to content

API service profiles

Marcin Słowiak edited this page Nov 11, 2018 · 3 revisions

API service got two profiles - dev and prod.

Dev profile

It uses H2 database - it is an in memory database which is launched when .jar starts and destroyed when .jar is stopped.

Prod profile

It uses real database located on private server.

Usage

Dev profile is set by default.

When you need to run service in prod profile you need to add application-prod.properties to resources directory and specify launching parameters.

There are two options how you can specify profile:

  1. java -jar -Dspring.profiles.active=production demo-0.0.1-SNAPSHOT.jar
  2. Create two configurations in 'Run configurations...'
    • Open 'Run...' tab
    • Open 'Edit Configurations...' option
    • When window shows add via 'plus' button another configuration
    • In 'Add New Configuration' choose 'Spring Boot'
    • Set 'Main class' to api.AnnouncementProcessorApiApplication
    • Add parameter in 'Ovveride parameters' to name: spring.profiles.active and value: prod (or dev)
Clone this wiki locally