Spring Boot example application
Table of Contents
Requirements
- Java 11+
Development
Generate a project by Spring Initializr VS Code plugin
See Spring Initializr Java Support for details.
- Press
Ctrl + Shift + P
to open command palette. - Type
Spring Initializr
to start generating a Maven or Gradle project. - Follow the wizard.
Development Cycle
- Test.
$ ./gradlew test
- Build an executable JAR.
$ ./gradlew bootJar
- Run.
$ java -jar ./build/libs/spring-boot-example-*.jar # with `dev` profile $ java -Dspring.profiles.active=dev -jar ./build/libs/spring-boot-example-*.jar
- Access http://localhost:8080/greet
- Generate JaCoCo reports.
$ ./gradlew jacocoTestReport
- Analyze by SonarScanner
# set access token $ cat ~/.gradle/gradle.properties systemProp.sonar.login=<token> $ ./gradlew sonarqube