Skip to content

spachava753/spring-boot-reference-architecure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Reference App

This application provides a base app to get started developing. Please see that project for important set up information.

Installations

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

Compile the App

mvn clean compile

This will download all the dependencies.

Running

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

Verify app is up and running

curl http://localhost:8001/refapp/health

Rest Api Documentation

This application is deployed with /ref context. The rest api doc generated by Swagger2 can be accessed by http://localhost:8001/ref/.

Create App war file

Create the war file.

mvn clean package

You can deploy the war file to Tomcat.

Cleanup App target

mvn clean

Build using Docker

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/.

Next: End to End testing

Automated end to end testing

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.

About

This repository is to demonstrate the best practices and architecture that a standard Spring Boot app should implement.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages