A boilerplate which uses Spring Boot 2 and Gradle
- Gradle 4 +
- JDK 8 +
This boilerplate comes bundled with the following features:
- Spring Boot Starter Web (version 2.0.4)
- Undertow web server, replacing the default Tomcat server
- Spring Actuator for health and metrics
- Log4j2 for better control over logging
- Logbook for logging API requests and responses
- YAML based Spring configuration with support for different deployment environment configuration
- Different configuration of Log4j2 based on the deployment environment
- A filter to assign an unique ID for each API request
- Clone the repository.
git clone https://github.com/ibipn/spring-boot-gradle-boilerplate.git
cd spring-boot-gradle-boilerplate/
- Build the project.
./gradlew bootJar
- Run the Spring Boot application.
./gradlew bootRun
If you need to run the application with different deployment environment properties,
SPRING_PROFILES_ACTIVE=production ./gradlew bootRun
- Build the docker image.
docker build \
--build-arg JAR_FILE=Spring-Boot-Gradle-Boilerplate-0.0.1-SNAPSHOT.jar \
-t spring-boot-gradle-boilerplate:0.0.1-SNAPSHOT \
.
- Run the application in docker container.
docker run --rm -p 8080:8080 spring-boot-gradle-boilerplate:0.0.1-SNAPSHOT
```# spring-boot-gradle-boilerplate-master