Spring Boot

From My Limbic Wiki

Comparaison with Spring Boot and Spring https://www.springboottutorial.com/spring-boot-vs-spring-mvc-vs-spring

What's new

Come with:

  • Autoconfiguration
    • Previously (Spring_MVC) Bean, Resources, Servlet, View Resolver configuration
  • Starters (Spring boot starter web ...)
    • Bring all the dependencis required to build web applications

Mock - Dependency Injection

@Component
public class WelcomeService {
  //Bla Bla Bla
}

@RestController
public class WelcomeController {

  @Autowired
  private WelcomeService service;

  @RequestMapping("/welcome")
  public String welcome() {
    return service.retrieveWelcomeMessage();
  }
}

Spring Boot Starter Project Options

Dependencies to use in pom.xml available to start faster a spring boot project.

spring-boot-starter-*:

  • -web-services - SOAP Web Services
  • -web - Web & RESTful applications
  • -test - Unit testing and Integration Testing
  • -jdbc - Traditional JDBC
  • -hateoas - Add HATEOAS features to your services
  • -security - Authentication and Authorization using Spring Security
  • -data-jpa - Spring Data JPA with Hibernate
  • -cache - Enabling Spring Framework’s caching support
  • -data-rest - Expose Simple REST Services using Spring Data REST

Technical Stuff

spring-boot-starter-*:

  • -actuator - To use advanced features like monitoring & tracing to your application out of the box
  • -undertow, spring-boot-starter-jetty, spring-boot-starter-tomcat - * To pick your specific choice of Embedded Servlet Container
  • -logging - For Logging using logback
  • -log4j2 - Logging using Log4j2