Spring Boot Tutorial For Beginners in 10 Steps

Spring Boot Goals

  • Enable building production ready applications quickly
  • Provide common non-functional features
    • embedded servers
    • metrics
    • health checks
    • externalized configuration

What Spring Boot is NOT!

  • ZERO code generation
  • Neither an application server nor a web server


  • Quick Starter Projects with Auto Configuration
    • Web
    • JPA
  • Embedded Servers
    • Tomcat, Jetty or Undertow
  • Production-ready features
    • metrics and health checks
    • externalized configuration


  • http://localhost:8080/books => Few hardcoded books

Step By Step Details

  • Step 1 : Introduction to Spring Boot - Goals and Important Features
  • Step 2 : Developing Spring Applications before Spring Boot
  • Step 3 : Using Spring Initializr to create a Spring Boot Application
  • Step 4 : Creating a Simple REST Controller
  • Step 5 : What is Spring Boot Auto Configuration?
    • Recommended Reading - http://www.springboottutorial.com/spring-boot-auto-configuration
    • Spring based applications have a lot of configuration. When we use Spring MVC, we need to configure component scan, dispatcher servlet, a view resolver, web jars(for delivering static content) among other things. When we use Hibernate/JPA, we would need to configure a datasource, an entity manager factory, a transaction manager among a host of other things. Spring Boot brings in new thought process around this - Can we bring more intelligence into this? When a spring mvc jar is added into an application, can we auto configure some beans automatically?
  • Step 6 : Spring Boot vs Spring vs Spring MVC
    • Recommended Reading - http://www.springboottutorial.com/spring-boot-vs-spring-mvc-vs-spring
    • Spring is about Dependency Injection. It makes it easy to develop loosely coupled applications. It makes applications testable.
    • Spring MVC brings loose coupling to web mvc application development with features like Dispatcher Servlet, View Resolver etc
    • Spring Boot eliminates the need for manual configuration with Spring and Spring MVC. You can use Spring and Spring MVC without needing a lot of configuration.
    • Spring Boot aims to enable production ready applications in quick time.
      • Actuator : Enables Advanced Monitoring and Tracing of applications.
      • Embedded Server Integrations - Since server is integrated into the application, I would NOT need to have a separate application server installed on the server.
      • Default Error Handling
  • Step 7 : Spring Boot Starter Projects - Starter Web and Starter JPA
    • Recommended Reading - http://www.springboottutorial.com/spring-boot-starter-projects
    • Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, just include the spring-boot-starter-data-jpa dependency in your project, and you are good to go.
  • Step 8 : Overview of different Spring Boot Starter Projects
    • As we see from Spring Boot Starter Web, starter projects help us in quickly getting started with developing specific types of applications.
    • spring-boot-starter-web-services - SOAP Web Services
    • spring-boot-starter-web - Web & RESTful applications
    • spring-boot-starter-test - Unit testing and Integration Testing
    • spring-boot-starter-jdbc - Traditional JDBC
    • spring-boot-starter-hateoas - Add HATEOAS features to your services
    • spring-boot-starter-security - Authentication and Authorization using Spring Security
    • spring-boot-starter-data-jpa - Spring Data JPA with Hibernate
    • spring-boot-starter-cache - Enabling Spring Framework’s caching support
    • spring-boot-starter-data-rest - Expose Simple REST Services using Spring Data REST
    • spring-boot-starter-actuator - To use advanced features like monitoring & tracing to your application out of the box
    • spring-boot-starter-undertow, spring-boot-starter-jetty, spring-boot-starter-tomcat - To pick your specific choice of Embedded Servlet Container
    • spring-boot-starter-logging - For Logging using logback
    • spring-boot-starter-log4j2 - Logging using Log4j2
  • Step 9 : Spring Boot Actuator
    • Spring Boot starter actuator actually exposes a lot of REST services and these services are compliant with the standard called HAL standard. And we would use a hal browser so that we can browse through the data which is provided by these services.Spring Boot Actuator exposes a lot of data - application info, metrics, dump, beans, env, config properties, audit events, heap dump, loggers, trace, health mappings and auto config. Actuator provides more metadata about your application.
  • Step 10 : Spring Boot Developer Tools
    • Why do you need to restart your server for every java and jsp change?
    • Spring Boot Developer Tools enables dynamic reloading of modified changes.
  • Spring Boot - Conclusion

Spring, Spring Boot and Spring Cloud - REST & Microservices





Complete Code Example


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


	<description>Demo project for Spring Boot</description>

		<relativePath/> <!-- lookup parent from repository -->









			<name>Spring Snapshots</name>
			<name>Spring Milestones</name>

			<name>Spring Snapshots</name>
			<name>Spring Milestones</name>



package com.in28minutes.springboot.basics.springbootin10steps;

public class Book {
	long id;
	String name;
	String author;

	public Book(long id, String name, String author) {
		this.id = id;
		this.name = name;
		this.author = author;

	public long getId() {
		return id;

	public String getName() {
		return name;

	public String getAuthor() {
		return author;

	public String toString() {
		return String.format("Book [id=%s, name=%s, author=%s]", id, name, author);



package com.in28minutes.springboot.basics.springbootin10steps;

import java.util.Arrays;
import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

public class BooksController {
	public List<Book> getAllBooks() {
		return Arrays.asList(
				new Book(1l, "Mastering Spring 5.2", "Ranga Karanam"));


package com.in28minutes.springboot.basics.springbootin10steps;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;

public class SpringbootIn10StepsApplication {

	public static void main(String[] args) {
		ApplicationContext applicationContext = 
				SpringApplication.run(SpringbootIn10StepsApplication.class, args);
		for (String name : applicationContext.getBeanDefinitionNames()) {


#logging.level.org.springframework = DEBUG


package com.in28minutes.springboot.basics.springbootin10steps;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

public class SpringbootIn10StepsApplicationTests {

	public void contextLoads() {


Related Posts

20 in28Minutes Courses with 240,000+ Learners

Get Amazing Offers on all in28Minutes Udemy Courses.

The in28Minutes Way

Understand what, why and the how about in28Minutes. Hear what our learners say about our courses. Understand how we design them.

JSP Servlets Tutorial for Beginners - Build Java Web Application in 25 Steps

In this course, you will learn the basics developing a Basic Todo Management Application using Java Servlets and JSP with Login and Logout functionalities.

Spring Boot, Maven and Eclipse Errors and TroubleShooting Guide and FAQ

Troubleshoot your Spring, Spring Boot, Maven and Eclipse issues using this guide from in28Minutes.

Mockito Tutorial for Beginner in 5 Steps

Mockito tutorial for Beginner in 5 Steps. Understand the basics of mocking with the most popular Java mocking framework with a simple mock example in 5 easy steps.

Maven Tutorial for Beginners in 5 Steps

Maven Tutorial for Beginners in 5 Steps. Learn the basics of Maven setting up a basic example with Spring Initializr.

JUnit Tutorial for Beginners in 5 Steps

JUnit Tutorial for Beginners in 5 Steps. Setting up a basic JUnit example and understanding the basics of junit.

JPA and Hibernate Tutorial For Beginners - 10 Steps with Spring Boot and H2

JPA and Hibernate in 10 Steps with H2 - Setting up a basic project example with Spring Boot and in memory database H2. Its a cake walk.

JPA and Hibernate Tutorial for Beginners - with Spring Boot

JPA and Hibernate with Spring Boot - Course Guide with Step by Step Details, Code Examples and the Notes

The in28Minutes Connect - connecting experts with the learners

in28Minutes Connect - connecting experts with the learners.