Spring Boot Complete Guide

This tutorial explains the basic concepts of Spring Boot and how to run a simple application using the Spring Boot framework. Also end of this tutorial, popular tutorials on Spring Boot has been collated and given for the readers reference.

Spring is the most popular and innovative community for the Java developers. They have changed the way how to build the enterprise applications and how to manage them. In the recent announcement, they come up with another amazing project which is called as “Spring Boot“.

spring boot

Spring Boot will get rid of all the fuss involved on configuring the dependencies for building the enterprise applications. Here as we know that configurations are fully loaded with bunch of XML files (Spring was first introduced the full fledged XML configurations), now they don’t like it. They don’t want anything to be configured or maintained in a file which is extra work for the developers.

Future Spring projects would not have any XML configurations as part of it, everything will be handled by the project Spring Boot. This article provides basic insights on what is all about Spring Boot and how it will benefit the developers. Also this page will be regularly updated with latest information on Spring Boot.

WHY We Need Spring Boot?

  • Spring Boot is next generation attempt to easy spring setup.
  • Spring Boot’s main benefit is configuring the resources based on what it finds in the classpath.
  • If your Maven POM includes JPA dependencies and a MYSQL driver, then Spring Boot will setup a persistence unit based on MySQL. If you’ve added a web dependency, then you will get Spring MVC configured with defaults.
  • When we talk about defaults, Spring Boot has its own opinions. If you are not specifying the details, it will use its own default configurations. If you want persistence, but don’t specify anything else in your POM file, then Spring Boot configures Hibernate as a JPA provider with an HSQLDB database.

The primary goals of spring boot:

  • To provide a radically faster and widely accessible getting started development experience for all Spring development. Since spring community has evolved so big, it is time to re-invent the way how spring applications are deployed in much quicker turn around time.
  • To be get started so quickely using the default values which are supported out of the box in the Spring Boot configurations.
  • To provide bunch of non-functional features/solutions that are very much common to large scale projects (e.g. embedded servers, security, metrics, health checks, externalized configuration).

Spring Boot Releases

Latest Released : Spring Boot 1.3.0.M5. This release schedule to be released on middle of October, 2015. 

  • Features Added in Spring Boot 1.3.0 are:
    • HTTP session persistence
    • JMS and AMQP configuration improvements
    • Logback and Log4j2 improvements
    • Excluding auto configuration classes through configuration
    • Auto configuration support for embedded MongoDB
    • Auto configuration support for H2 web console

What is Spring Boot?


Spring Boot is approach to develop Spring based application with very less configuration. It leverages existing Spring projects as well as Third party projects to develop production ready applications. It provides a set of Starter Pom’s or gradle build files which one can use to add required dependencies and also facilitate auto configuration.

Depending on the libraries on its classpath, Spring Boot automatically configures required classes. For example to interact with DB, if there is Spring Data libraries on class path then it automatically sets up connection to DB along with the Data Source class.

Spring Boot shipped with command line tool (Groovy) for building the applications and another one is Java implementation for Java developers. However, Groovy follows the Java syntax, which is easy for the Java developers to use either of the tool.

If you want to quick start with an example, using the Groovy’s CLI tool is the easy one.

Spring Boot CLI

It is the easiest and quickest way to start using the Spring Boot. It is a command line tool used for executing the groovy scripts. In summary, you can install this tool by following these steps:

  1. Download the binary distributions for this project from here. Spring Boot CLI requires Java JDK v1.6 or above in order to run. Groovy v2.1 is packaged as part of this distribution, and therefore does not need to be installed (any existing Groovy installation is ignored)
  2. If you unpack the the zip file, you will find spring.bat which will check the  all the settings. This script can be found under the directory /bin.

The summary of what is provided in the installation instructions file inside the package.

Thank you for downloading the Spring Boot CLI tool. Please follow these instructions
in order to complete your installation.
Spring Boot CLI requires Java JDK v1.6 or above in order to run. Groovy v2.1 is packaged
as part of this distribution, and therefore does not need to be installed (any existing
Groovy installation is ignored).
The CLI will use whatever JDK it finds on your path, to check that you have an appropriate
version you should run:
java -version
Alternatively, you can set the JAVA_HOME environment variable to point an suitable JDK.
Environment Variables
No specific environment variables are required to run the CLI, however, you may want to
set SPRING_HOME to point to a specific installation.  You should also add SPRING_HOME/bin
to your PATH environment variable.
Checking Your Installation
To test if you have successfully install the CLI you can run the following command:
spring --version

If you are working with Linux distributions like Ubuntu, then run the following command to install through GVM

$ gvm install springboot
$ spring --version
Spring Boot v0.5.0.M4</code>

Hello Word Example Using Spring Boot

I have used the same example provided in the spring boot’s official documentation.

Create the app.groovy with the following lines of code.

class ThisWillActuallyRun {
    String home() {
        return "Hello World!"

Once the above file is created, you can run the application by using the following command:

$spring run app.grrovy

You can invoke the http://localhost:8080 in your browser and you will see the result “Hello World!”.The above command can invoke the application and run it in the web server.

If any dependencies are required like web server, etc. can be resolved by the Spring Boot itself.

There is another implementation of the same project for the Java developers. If you don’t want to use the above implementation, you can choose the Java implementation with Maven build (Read : How to Install Maven on Windows / Ubuntu ?). As a first step, you have to create create the pom.xml with the following artifacts.

<?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">
<!-- Inherit defaults from Spring Boot -->
<!-- Add typical dependencies for a web application -->
<!-- Package as an executable JAR -->

<!-- Allow access to Spring milestones and snapshots -->
<!-- (you don't need this if you are using anything after 0.5.0.M2) -->

Once maven is in the class path, it is very easy to create a maven project and run the example. Just create a Java file with the below code snippet:

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
public class SampleController {
  String home() {
    return "Hello World!";

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

Once you have created the above Java file and the pom.xml in the same directory, please run the following command:

$ mvn package
$ java -jar target/myproject-0.0.1-SNAPSHOT.jar

First statement invokes the pom.xml and builds the complete package by downloading all the dependencies. The second statement makes the spring application and bundle with the web server. As said in the above groovy example, you can invoke the application in the browser.

I hope this article have provided the basic steps to build the applications using Spring Boot. Keep visiting this page for my update on the Spring Boot releases and list of features in the each release. Below section you can browse the list of Spring Boot tutorials published in JavaBeat.

Servlet Containers Support

The following are the list of servlet containers supported out of the box in spring boot applications.

NameServlet VersionJava Version
Tomcat 83.1Java 7+
Tomcat 73.0Java 6+
Jetty 93.1Java 7+
Jetty 83.0Java 6+
Undertow 1.13.1Java 7+

Starter POMs

Spring Boot has set of pre-defined starter POMs for the developer’s convenience. The starter POMs are convenient dependency descriptors that can be added to your application’s Maven. In simple words, if you are developing a project that uses Spring Batch for batch processing, you just have to include spring-boot-starter-batch that will import all the required dependencies for the Spring Batch application. This reduces the burden of searching and configuring all the dependencies required for a framework.

Spring offers wide range of started POMs that can be used in your application. Here is the list of started POMs.

Starter POMPurpose

Template Engines Support

Spring Boot provides auto-configuration support for the following template engines:

If you are using any of the above template engines, spring boot will automatically pick the templates from src/main/resources/templates. It is good practice to avoid using JSP for the templates as it has lot of limitations using with embedded servlet containers.

If you have problems in understanding this, please  write it in the comments section.

Spring Boot Tutorials

  • Spring Boot and Spring MVC : This tutorial for beginners who are interested to learn basics of Spring Boot and Spring MVC working together. At the end of this tutorial, you could run a simple SPring MVC application using Spring Boot.
  • Integration Testing REST API in Spring Boot : This tutorial explains how to write the integration testing REST API in Spring Boot. This tutorial uses the examples written in the previous tutorial. This tutorial intends to create the automated testing using JUnit and runs with Spring Boot application.
  • Spring Data REST Exporter : This tutorial provides the detailed instruction on how to use Spring Data REST project in your Spring MVC applications to export your JPA entities. The greatest advantage of using the Spring Data REST is that, it easily exports the entities and made available through the HTTP protocol.
  • Spring Data Neo4j 3 REST Exporter : This guide walks you through the process of converting a runnable JAR application that was built with Spring Boot into a WAR file that you can run in any standard servlet container. You’ll take a simple Spring MVC web app and build a WAR file using Spring Boot.
  • External Configurations for Spring Boot ApplicationsThis tutorials explains you the different ways how you can do external configurations for Spring Boot applications. When you work with the real time environments, External Configurations for Spring Boot would become important for the flexibility. There are multiple sources from where the configuration can be read from and the order in which the configuration properties are overridden is determined by Spring Boot.
  • Logging Configuration in Spring Boot : Spring Boot provides great support for logging and provides lot of hooks to configure the same. In this article we are going to see the default support for logging in Spring Boot, then use the hooks i.e the spring properties to configure the logging. At the end of this article, you will be familiar with the logging configuration in spring boot applications.
  • Working with SQL Databases and Spring Boot : SQL Databases are an integral part of any application being development. They help in persisting application data. SQL Databases provide advanced support for querying data using the Structured Query Language(SQL). Spring Boot provides great support for interacting with SQL databases with minimal or no XML configurations.
  • MySQL Configurations : This tutorial explains how to configure MySQL database for your spring boot applications.
  • Spring Data JPA Tutorial using Spring Boot :  This tutorial guides you through on building simple REST APIs using Spring Data JPA and Spring Boot. At the end of this tutorial, you would be able to write the applications with Spring Data JPA using Spring Boot.
  • Complete Guide for Spring Boot Actuator : Spring Boot Actuator is a sub-project / feature that is part of the spring boot framework. It is not a separate framework to be added to your applications. Main purpose of this feature is to provide various useful metrics about the applications. It is very helpful in the production environment to check the various metrics like health of your application, configurations, error page, version details, etc.
  • Spring Cache Tutorial : This tutorial explains how to configure spring cache with the latest version of spring (spring 4) and also it highlights the implementation architecture of spring cache framework. It uses spring boot for configuring and running the application.
  • Spring Security Article : This tutorial focuses more about the core module of spring security and one simple example that demonstrates the core functionality.

Spring Boot Videos

Here is the one good video on Spring Book introduction by Josh Long.

Spring Boot Adoption

Eugen has published a report about the Spring Boot adoption here. This chart shows that there is more developers started using Spring Boot for their project development.

Spring Boot Adoption

Here is the chart that shows number is tags created on stack over flow forums for spring boot topic. This chart shows up to the month of July 2015. This shows how fast spring boot is adopted by most developers for the real time implementation.

spring boot stackoverflow

Spring Boot Resources

If you come across any interesting facts or tutorials for Spring Boot, please send me the details. I will update this section with more useful resources.

I hope this tutorial provide enough details about Spring Boot. This page would be regularly updated and maintained with latest information about Spring Boot framework. If you are looking for any specific information, please write it in the comments section.

Leave a Reply

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

Pin It on Pinterest

Share This

Share this post with your friends!