Creating Spring Boot Application with Spring Tool Suite

Tags: Java Spring Boot

In this article we will learn step by step guide to create a new Spring Boot web application using Spring Tool Suite.

You can download Spring Tool Suite from this link

First step, open Spring Tool Suite on your machine and choose menu File -> New -> Spring Starter Project

Open New Spring Starter Project Menu

Then input new project information on New Spring Starter Project popup as below and click on Next button.

Input New Spring Starter Project Options

Choose dependencies for your Spring Boot project on New Spring Starter Project Dependencies popup, in this example we only choose Web dependency to create a simple web application, then click on Next button.

Choose New Spring Starter Project Dependencies

Before finish creating project, Spring Tool Suite will show to you the link that you can manually download the project online. Let click on Finish button to finish creating propject.

Finish Creating Spring Starter Project

After finish creating, we get the new project with structure as below screenshot. There is a main class generated to bootstrap the Spring Boot application by using SpringApplication.run() method.

Spring Boot Project Structure and main class

Now you can run the created Spring Boot application by click on Run icon -> Run As -> Spring Boot App

Run Spring Boot application

During the Spring Boot application starting you can see the log of application in Console window as below.

Spring Boot Application Run Console

After finish starting the application, the embedded Tomcat server by default started at port 8080 to serve your web application. Let open the web application on browser via URL http://localhost:8080/ to see the default error page as below as we are not implement any feature for the app.

Spring Boot Whitelabel Error Page

Next step, create first controller class for our application by right click on package and choose New -> Class

Creating New Controller class

And input new class information as below screenshot then click Finish button.

Creating HelloController class

A new HelloController.java class will be created, then we implement a simple controller to show a message when user access the web app.

package simplesolution.dev;

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

@RestController
public class HelloController {
	
	@RequestMapping("/hello")
	public String hello() {
		return "Hello Message from simplesolution.dev";
	}

}

Re run the application and open browser the URL http://localhost:8080/hello to observe the result.

Creating HelloController class

That’s all we need to know to create a simple Spring Boot Web application using Spring Tool Suite.

Download Source Code

The source code in this article can be found at: https://github.com/simplesolutiondev/FirstSpringBootApp

Happy Coding 😊

Spring Boot Web Application Download CSV File

Spring Boot Web Application Download Excel File