Skip to content

Latest commit

 

History

History
58 lines (33 loc) · 2.71 KB

File metadata and controls

58 lines (33 loc) · 2.71 KB

Spring Boot Backend Sample

Requirements

MariaDB

Create two databases, development and test. The database must be running on localhost:3306. The database username is root the password is '' (empty) by default.

Important
Use MariaDB 10.4.x or later to avoid issues mentioned below.
Important
Because of this problem the database server must be configured to use large prefixes for InnoDB.
Important
In recent MariaDB versions (up from 10.2.x) this is enabled by default. In older versions dynamic row format must be configured explicitly.
Flyway

Create or edit your Maven settings.xml (at $HOME/.m2/settings.xml or %USERPROFILE%\.m2\settings.xml) according to the settings.sample.xml in the root of this repository.

Profiles

The roject relies on Maven profiles for development and Spring profiles for execution.

Maven

There are two profiles: development and test.

Important
Define profiles only in ~/.m2/settings.xml.

When running flyway:clean or similar select the right profile so that the plugin could select the right database.

./mvnw flyway:clean -Pdevelopment or ./mvnw flyway:clean -Ptest

Spring

There are two Spring profiles: development and local.

During development, when starting the Application class (from your IDE) specify -Dspring.profiles.active=development,local to enable the profiles.

When starting the app through Maven either use the -Dspring-boot.run.profiles=development,local flag or use the development Maven flag because it sets this property by default (this will activate both Spring profiles, not just the developement).

To start the app in development mode

./mvnw spring-boot:run -Pdevelopment

To run the tests

./mvnw test -Ptest

The local profile should be used to configure specific things related to a particular development machine. For example if you use a different database port or username/password combination set these in the application-local.properties.

Properties in the local profile will take precedence over the development profile. This enables you to override default properties when needed.

Important
This file shouldn’t be checked into version control. Also, make sure to rename application-local.sample.properties to application-local.properties, otherwise it won’t be picked up by Spring.