Saturday , August 19 2017
Home / Spring Boot / Simple Spring Boot Example

Simple Spring Boot Example

In this tutorial, I am going to show you the most popular and trending module in Spring Framework that is Spring Boot. By this tutorials you can get to know how to write a Simple Spring Boot Example.

Used Technologies :

  • Spring 3.2.3
  • Spring Boot 1.5.1
  • Java 8
  • Maven 3

Spring Boot Example :

Here I am going to implement a basic hello world spring boot example.

Project Structure :

Spring Boot Example

Maven Dependencies :

To make our example as simple as possible, I have placed dependencies in pom.xml what just I want.

<project xmlns="" xmlns:xsi=""


        <!-- Generic properties -->

        <!-- Spring -->



Create Application Class :

package com.onlinetutorialspoint.spring.boot;

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

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

@SpringBootApplication annotation tells the spring application context, it is an spring boot application. Most of the developers can used to define the spring boot main classes with the @Configuration, @EnableAutoConfiguration and @ComponentScan annotations. Since these annotations are mandatory to every Spring application, the Spring Boot given us an annotation called @SpringBootApplication instead.

Here @Configuration + @EnableAutoConfiguration + @ComponentScan = @SpringBootApplication

Create a Controller Class :

package com.onlinetutorialspoint.spring.boot;

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

public class HelloController {
    public String index() {
        return "Hello World Spring !";

Running the Spring Boot Example :

On e of the biggest advantage of Spring boot application is, to run we don’t deploy the application in any server. We can run the above spring boot example as a simple Java standalone application.

Run the main method in

If every thing goes well, you can find the below text in your console.

Spring Boot Example out
Now it is time to show out hello message on browser.

Spring boot example output

Happy Learning 🙂

Download Example

About chandrashekhar

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,


How to change Spring Boot Tomcat Port Number

In this tutorials, I am going to show you how to change the Spring Boot …

Leave a Reply

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