/spring-boot-example

Spring Boot example application

Primary LanguageJavaApache License 2.0Apache-2.0

Spring Boot example application

CircleCI Known Vulnerabilities Quality Gate Status

Table of Contents

Requirements

  • Java 11+

Development

Generate a project by Spring Initializr VS Code plugin

See Spring Initializr Java Support for details.

  1. Press Ctrl + Shift + P to open command palette.
  2. Type Spring Initializr to start generating a Maven or Gradle project.
  3. Follow the wizard.

Development Cycle

  1. Test.
    $ ./gradlew test
  2. Build an executable JAR.
    $ ./gradlew bootJar
  3. Run.
    $ java -jar ./build/libs/spring-boot-example-*.jar
    # with `dev` profile
    $ java -Dspring.profiles.active=dev -jar ./build/libs/spring-boot-example-*.jar
  4. Access http://localhost:8080/greet
  5. Generate JaCoCo reports.
    $ ./gradlew jacocoTestReport
  6. Analyze by SonarScanner
    # set access token
    $ cat ~/.gradle/gradle.properties 
    systemProp.sonar.login=<token>
    $ ./gradlew sonarqube

References