Spring Boot Hello World Example using STS

In this article, you will learn how to create a sample Maven project for the Hello World application in Spring Boot with Spring Tool Suite(STS) Eclipse plug-in. Here we will use the following software dependency to create this example:

Software Dependency

Step by step creation of Hello World Example

We hope the above software dependencies are already available in your system if not follow the specified installation steps to set up your spring boot application environment.

Now you just need to follow the below steps:

Step-1. Click on eclipse menu File > New and type spring and select Spring Starter Project then click on Next button as below image:

6 min

Step-2. Once you click on Next button, you will be ask for below details:

  • Project Name
  • Type
  • Java Version
  • Group Id
  • Artifact Id
  • Package
  • etc…

Now you just provide the Project Name: FirstSpringBootProject, Type: Maven, Java Version: 8, Group: com.javacodepoint, Artifact: FirstSpringBootProject, Package: com.javacodepoint.sts as you can see the below image. After that click on the Next button.

new sts project dialog

Step-3. Now select the Spring Starter Project Dependencies. Here we will select Spring Web dependency as you can see below image. After that click on the Finish button.

sts project dependency selection

When you click on Finish button you can see the below Maven project structure got created in your eclipse:

maven project structure


<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
		<relativePath/> <!-- lookup parent from repository -->
	<description>First project for Spring Boot</description>


package com.javacodepoint.sts;

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

public class FirstSpringBootProjectApplication {

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


Step-4. Create a new HelloWorldController class by Right click on com.javacodepoint.sts package > New > Class and type the class name and click on the Finish button as below image:

java class creation dialog

Step-5. Now copy the below code and paste it in HelloWorldController.java file.

package com.javacodepoint.sts;

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

 * @author javacodepoint
public class HelloWorldController {
	public String hello() {
		return "Hello World!";

Step-6. Now Run the created application. Right-click on FirstSpringBootProjectApplication.java > Run As > Java Application then it will start the server as you can see the below image Started FirstSpringBootProjectApplication in 8.119 seconds.

Application started running log

Step-7. Test the application by accessing the URL: localhost:8080/ in any browser as below image:

running application in browser

That’s all you have successfully created and executed a Hello World Spring boot application.

Hope you like it!

Share with friends

Leave a Comment

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