- Spring Boot - Production-ready Spring applications
Source code available on GitHub public repository. Self-contained runnable release or pre-release jars available on GitHub public repository releases. For how to run a release or pre-release jar, see the Building and running a self-contained jar section.
Requires Apache Maven to run.
Available spring profiles to run:
- dev - in memory h2 db - configuration in src/main/resources/application-dev.yml
- staging - standalone MySQL db - configuration in src/main/resources/application-staging.yml - The schema will have to be created manually but the tables will be created by hibernate using "ddl-auto: update" on first run
Run with the default spring profile:
- Default profile is dev - set default profile in src/main/application.yml
$ cd ht-rest-api
$ mvn spring-boot:runRun with a chosen spring profile and overrided application properties:
$ cd ht-rest-api
$ mvn spring-boot:run -Drun.profiles=staging -Drun.arguments="--server.port=${server.port},--spring.datasource.url=${spring.datasource.url},--spring.datasource.username=${spring.datasource.username},--spring.datasource.password=${spring.datasource.password}"Example with app defaults:
mvn spring-boot:run -Drun.profiles=staging -Drun.arguments="--server.port=9000,--spring.datasource.url=jdbc:mysql://127.0.0.1:3306/testco_tech_db,--spring.datasource.username=htadmin,--spring.datasource.password=admin@ht"
Requires Apache Maven to build.
Building:
$ cd ht-rest-api
$ mvn package spring-boot:repackageRunning with the default spring profile:
$ cd ht-rest-api
$ cd target
$ java -jar restapi-0.0.1-SNAPSHOT.jarRun with a chosen spring profile and overrided application properties:
$ cd ht-rest-api
$ cd target
$ java -jar restapi-0.0.1-SNAPSHOT.jar --spring.profiles.active=staging --server.port=${server.port} --spring.datasource.url=${spring.datasource.url} --spring.datasource.username=${spring.datasource.username} --spring.datasource.password=${spring.datasource.password}Example with app defaults:
java -jar restapi-0.0.1-SNAPSHOT.jar --spring.profiles.active=staging --server.port=9000 --spring.datasource.url=jdbc:mysql://127.0.0.1:3306/testco_tech_db --spring.datasource.username=htadmin --spring.dasource.password=admin@ht
$ cd ht-rest-api
$ mvn test -P test$ cd ht-rest-api
$ mvn integration-test -P integrationFollow the steps in this article to setup lombok in eclipse/sts: Setup Lombok in STS