Spring Boot Hello World Example

Spring Boot Hello World Example

This spring boot tutorial shows how to create a basic Hello World application using IntelliJ IDEA. Nowadays Spring Boot is a very popular technique for creating microservices. It is an open-source Java-based framework. Comparing to Spring it gives more benefits to the developer such as annotation configurations and default codes, more flexible, configuration is easy, no manual XML configurations like Spring because it creates automatically and it saves the development time.

Spring boot provides Database transaction interfaces so easy to communicate with MySQL, Cassandra, or MongoDB, and it more compatible to develop rest endpoints and it provides POM file it helps to manage dependencies in your project furthermore Spring Boot is providing embedded servlet container so you can use web servers like Tomcat to deploy your project.

Below steps help you to build the Spring Boot Hello world application. You can create a fresh Spring Boot application from here.

Firstly we have to understand the structure of the project since it is a more important point in Spring Boot as well as Spring, This is the structure of a project.

Spring Boot | Hello World | Spring | Micro service |

Secondly, better understand the pom file. This will create automatically, all your dependencies should define here. E.g – MySQL connector, Embedded Tomcat, JUnit.
Below is the pom file.

<?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">
		<relativePath/> <!-- lookup parent from repository -->
	<description>test app</description>






Then create the Controller class I named it as “FirstController.java” and past or write this code in to it.

package com.example.learnspringboot.Controller;

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

public class FirstController {

    //URL -

    public String sayHello() {
        return "Hello";

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


Finally, you can run the project and open the web browser and hit this on the URL bar. http://localhost:8080/hello/world then it will return “Hello World !!!!!”

After learning this tutorial you can understand the GET and POST methods in Spring Boot referring to my other articles.

Git Location – https://github.com/rajithabhanuka/Learnspringboot.git