What is Spring Boot and what are its advantages

Upasana | August 05, 2019 | 2 min read | 118 views


Spring Boot makes it easy to create stand-alone, production grade Spring based applications that you can "just run" with an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss.

Main features of Spring Boot

  1. Create stand-alone Spring applications (12 factor app style)

  2. Embed Netty, Tomcat, Jetty or Undertow directly into executable jar (no need to deploy WAR files)

  3. Provide opinionated starter POMs to simplify your Maven or Gradle configuration

  4. Automatically configure Spring whenever possible

  5. Provide production-ready features such as metrics, health checks and externalized configuration

  6. Absolutely no code generation and no requirement for XML configuration

  7. Support for Spring 5 webflux and reactive (using project Reactor) programming in Spring Boot 2

Current version of Spring Boot as of writing this document is 1.5.21 and 2.1.6

You can create a Spring Boot starter project by selecting the required dependencies for you project using online tool hosted at https://start.spring.io/

Bare minimum dependencies for any spring boot application are:

 dependencies {
    compile("org.springframework.boot:spring-boot-starter-web:1.5.21.RELEASE")
}

The main java class for Spring Boot application will look something like the following:

SampleApplication
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

@Controller
@EnableAutoConfiguration
public class SampleController {

    @RequestMapping("/")
    @ResponseBody
    String home() {
        return "Hello World!";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(SampleController.class, args);
    }
}

You can directly run this class, without deploying it to a servlet container.


Top articles in this category:
  1. Spring Cloud and its advantages
  2. 50 microservices interview questions for Java developers
  3. Cracking Spring Microservices Interviews - question bank
  4. Is it a good practice to deploy multiple microservices in a single tomcat container
  5. Why Microservices are better than Monoliths
  6. How will you Partition a typical e-shop into Microservices Architecture

Recommended books for interview preparation:

Find more on this topic:
Buy interview books

Java & Microservices interview refresher for experienced developers.