This application provides a base app to get started developing. Please see that project for important set up information.
You need to install:
- Git
- Maven
- JDK 1.8
For installing Gradle, Maven and JDK 1.8, I would suggest using Sdkman. See here.
This project uses java 1.8. I suggest installing SdkMan and using that to install Gradle, Maven, or JDK 1.8. To install these using Sdkman, just do:
sdk install java 8.0.181-oracle
sdk install maven
mvn clean compile
This will download all the dependencies.
You can create a war file to deploy, or you can just run from the command line. It has multiple profiles to support various environments. (dev, qa, stage, prod)
In order to run, it needs to have kafka running. I suggest you use docker.
docker run -d --name kafka -p 9092:9092 -e KAFKA_ADVERTISED_HOST_NAME=localhost -e KAFKA_CREATE_TOPICS="test-topic:1:1" blacktop/kafka
The project's default profile is dev. If you don't specify a profile, it will go with dev. To run from the command line, use:
mvn spring-boot:run
curl http://localhost:8001/refapp/health
This application is deployed with /ref context. The rest api doc generated by Swagger2 can be accessed by http://localhost:8001/ref/.
Create the war file.
mvn clean package
You can deploy the war file to Tomcat.
mvn clean
To build the app using a docker container:
docker build -t spring-boot-reference-architecure .
docker run -it -d -p 9011:8001 spring-boot-reference-architecure
This will start the App at http://localhost:9011/refapp/
.
To run the tests, use Maven or Gradle
mvn clean test
If you want to build without running the tests:
mvn clean compile
To run code coverage with JaCoCo, just do
mvn clean test jacoco:report
The location of the JaCoCo reports is available at build/jacoco/test/html/index.html.