Here is a Spring Boot cheatsheet:

Spring Boot Configuration


  • Cloud:
  • CLI:




plugins {
    id 'org.springframework.boot' version '2.1.8.RELEASE'

Basic Project creation with spring init:

spring init -dweb,jpa

Common starters:

  • web  Web applications using Spring MVC (Tomcat embedded)
  • test Spring test using JUnit, Hamcrest and Mockito
  • security Secured services with Spring Security
  • webflux WebFlux applications using Spring Framework’s Reactive Web
  • websocket WebSocket applications using Spring Framework’s WebSocket
  • data-jdbc Configured resources to use Spring Data JDBC
  • data-jpa Persist data in SQL stores with Java Persistence API
  • data-rest Web applications using Spring Data repositories over REST
  • actuator Production ready features using Spring's Actuator (monitor and manage)

Spring Boot Coding

 Base class:

// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration
public class DemoApplication {
  public static void main(String[] args) {, args);

RestController example

public class CustomerController { @RequestMapping("/") public List<Customer> findAll() { List<Customer> customerList = new ArrayList<Customer>(); customerList.add(new Customer(1, "frank")); customerList.add(new Customer(2, "john")); return customerList; } }

Controller with Repository example

public class UserController {

  private UserRepository userRepository;

  public UserController(UserRepository userRepository) {
    this.userRepository = userRepository;

Test Class example:

// Load context via Spring Boot
@SpringApplicationConfiguration(classes = ReadinglistApplication.class)
public class ReadinglistApplicationTests {
  // Test that the context successfully loads (the method can be empty -> the test will fail if the context cannot be loaded)
  public void contextLoads() {
FREE WildFly Application Server - JBoss - Quarkus - Drools Tutorials