An overview of Spring Boot

14 / Oct / 2016 by Ravi Kumar 0 comments

I have come up with this blog that outlines:

  1. What is Spring Boot?
  2. Why do we use it?
  3. How to get started?

1. What is Spring Boot?

Spring boot from Spring is just another project enabling developers to create stand-alone, production-grade Spring based applications.

2. Why do we use it?

  1. Create stand-alone Spring applications
  2. Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files). You can create a war file and deploy if need be.
  3. Provide opinionated ‘starter’ POMs to simplify your Maven configuration
  4. Absolutely no code generation and no requirement for XML configuration (Automatically configure spring wherever possible)

3. How to get started?

There are multiple ways you can get started with spring boot application eg – Spring Boot CLI, Maven or gradle build tool.

I am going to use Eclipse + Maven. However, if you prefer using gradle or boot client there are many examples that you can find – Here is one with CLI .

Let’s get started –

  1. Create a maven project with following archetype

2. Now you will get default pom.xml file with many dependencies ( these dependencies are not required as it’s just an example, so I am removing all dependencies except the one outlined below) –


Here is how your maven may look like –

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">


<name>Spring Boot Blank Project (from ;


<!-- <start-class>com.ttn.aem.springboot.main.App</start-class> -->



3. You will get 3 generated classes. Out of these, we need only class which we will use as a starter class for our application. Here is how your will look  –

package com.ttn.aem.springboot.main;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class App {
    public static void main(String[] args) {, args);

@SpringBootApplication works as entry point for the application and bootstrap spring. When applicaiton starts spring boot search for the configuration annotation.

We can also use @EnableAutoConfiguration and @ComponentScan instead of @SpringBootApplication, depending on the preferences.

We have also given scanBasePackages along with @SpringBootApplication so that it is easy to look for the configuration or the classes for which beans needs to be created.

4. Here is our controller code –

package com.ttn.aem.springboot.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

public class HelloController {

    public String hello() {
        return "Hello World!";

    public int calc(@RequestParam int left, @RequestParam int right) {
        return left+right;

RestController is pretty straight forward isn’t it?

And we already have instructed spring to scan com.ttn.aem.springboot.controllers package

What’s next?

That’s all – Our application is ready to build and run.

run mvn clean instal


java -jar target/<jarname>.jar

Now go to the below link:

http://localhost:8000/calc?left=10&right=5 and http:localhost:8080

You see it works. Was it ever so easy to create a spring rest application?

  • No Web.xml
  • No dispatcher-servlet.xml
  • No applicationContext.xml
  • No Annotation configuration classes
  • and the list goes on.

Please share your thoughts in the comments below.


Leave a Reply

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