Spring Boot

 Spring Boot

  • Easy to create standalone applications
  • Handles predictable setup for developer e.g. If JPA implementation is on the classpath, it will automatically create JPA Entity Manager Factory
  • Embed containers (Tomcat, Jetty etc)
  • Automatically configure Spring components wherever possible
  • Very useful for rapid development
  • It is NOT code generator or IDE plugin

What does @SpringBootApplication do?

It adds following annotations

  • @Configuration tags the class as a source of bean definitions for the application context
  • @EnableAutoConfiguration tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings
  • It automatically adds @EnableWebMvc when it sees spring-webmvc on the classpath. This flags the application as a web application and activates key behaviours such as setting up a DispatcherServlet
  • @ComponentScan tells Spring to look for other components, configurations, and services in the package, allowing it to find the controllers

Spring Boot Parent POM and common starter dependencies

Parent POM

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>

Common Starter Dependencies

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>

  • spring-boot-starter
  • spring-boot-starter-web
  • spring-boot-starter-test
  • spring-boot-starter-jdbc
  • spring-boot-starter-jpa
  • spring-boot-starter-batch

Resources

Leave a Reply

Your email address will not be published. Required fields are marked *