Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Setting up the project
Frequently Asked Questions
Key Takeaways
Last Updated: Mar 27, 2024

Spring Boot Hello World Example

Master Python: Predicting weather forecasts
Ashwin Goyal
Product Manager @


Spring Boot is a project that uses the Spring Framework as its foundation. It makes setting up, configuring, and running simple web-based applications easier and faster. 

In this article, we will learn Spring Boot. You must have a basic understanding of Spring Framework before learning Spring Boot.

In this blog, we will be creating a Maven project for the Hello world example.


Before starting with the project we need to following tools and software to create our project

  • Spring Boot 2.6.2
  • JavaSE 1.8
  • Maven 3.3.9
  • Any IDE or editor of your choice
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Setting up the project

We will create a Maven project so to make the project follow the following steps

We will create a Maven project so to make the project follow the following steps

  1. Open Spring initializr
  2. Provide the Group name and  Artifact id.
  3. Fill up the name and Description of the project.
  4. Select the jar packaging and desired java version
  5. Select the Maven Project and language Java
  6. Select the version of spring boot.
  7. Add Spring web as a dependency.
  8. Click on generate button it will wrap all the specifications provided by you into a jar file and will download a .rar file
  9. Extract the RAR File and import the project to your IDE. When the project is imported the IDE show the following directory structure.
  10. Create a package with the name com.demo.controller inside folder src/main/java.

Create a controller class with the name HelloWorld

11. Create a method hello() that returns “Hello world” String.

package com.demo.controller;  
import org.springframework.web.bind.annotation.RequestMapping;  
import org.springframework.web.bind.annotation.RestController;  
public class HelloWorld   
public String hello()   
return "Hello World";  


12. Create and run the

package com.demo;  
import org.springframework.boot.SpringApplication;  
import org.springframework.boot.autoconfigure.SpringBootApplication;  
public class HelloWorldApplication  
public static void main(String[] args)   
{, args);  


Must Read Spring Tool Suite.

Frequently Asked Questions

1) What is Spring?

The Spring framework is one of the most popular application development frameworks of Java. The important feature of the spring framework is dependency injection or the Inversion of Control.

2) What is a Spring Boot?

Spring Boot is a Spring module that extends the Spring framework's RAD (Rapid Application Development) capabilities.

It's used to create stand-alone spring-based applications that we can just run because spring configuration is minimal.

3) What is the latest version of spring boot?

The current latest stable version of spring boot is 2.6.2

Key Takeaways

In this blog, we discussed setting up a hello world example in spring boot. We discussed the requirements and steps in detail to develop the hello world project in spring boot.

Apart from this, you can also expand your knowledge by referring to these articles on Spring Boot dependency management and Spring Boot packaging.

You can also consider our Spring Boot Course to give your career an edge over others.

Happy Learning!

Next article
Swagger in Spring Boot
Live masterclass