The application.properties file declares all the configuration
options that the API server accepts in addition to configuration options of the
Spring Framework.
When started using the bootRun Gradle task, the API server
loads the application-dev-default.properties and
application-dev.properties files. See "Development
Configuration" for more details.
Create a PostgreSQL instance before running the API server. The ./scripts
directory contains a Docker Compose helper configuration to create PostgreSQL
and PGAdmin containers. It also creates a fresh develop database as soon as
the PostgreSQL container starts. It is also the default data-source
configuration in application-dev-default.properties.
docker-compose -f scripts/postgres-with-docker-compose.yaml up -dTo delete and recreate the development database, restart the postgres-init
container.
docker-compose -f scripts/postgres-with-docker-compose.yaml restart postgres-initUse API run configuration to start the API server from
IntelliJ IDEA. Hot-reloading is pre-configured in
application-dev-default.properties. Recompile the
project source using Ctrl (Cmd) + F9 to hot-reload a running API server
instance.
To run from a terminal, use the Gradle wrapper.
./gradlew bootRunTo enable hot-reload, build the source continuously while running the bootRun
Gradle task in parallel.
./gradlew build --continuousBoth the bootRun Gradle task and the API IntelliJ run
configuration, activate the dev-default and dev Spring
profiles. application-dev-default.properties contains
some sensible defaults required for development.
application-dev.properties is gitignored and meant to
store personal configuration, such as API secrets, etc.
application-test.properties contains configuration critical
for running integration tests. Both, the "Integration Tests" IntelliJ run
configuration and the integrationTest Gradle task, enable
the test profile to load this configuration.
The test profile configures the application to use the PostgreSQL
module of Testcontainers. It requires
access to an active Docker daemon. It creates one PostgreSQL container per test
class and one database per test.