Master java skills

Spring Boot using STS

STS stands for Spring Tool Suite. It is an IDE built on top of eclipse with added support for spring framework. In this tutorial, we will learn how to develop a microservice using STS without using Spring Initializr.

Step 1 :

Create a Spring starter project

Step 2 :

Provide all the necessary information as given below

Step 3 :

In the next step, add the required dependencies. In this example, we will add only spring web dependency.

Step 4 :

Click on Finish. It will generate a maven project for spring boot. Project structure is like below.

Step 5:

Create a controller class.

package com.javatrainingschool;

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

@RestController
@RequestMapping("/test")
public class TestingController {
	
	@RequestMapping("/welcome")
	public String welcome() {
		return "Welcome to your first spring boot application";
	}
	
	@RequestMapping("/home")
	public String home() {
		return "This is the home url";
	}

}

Step 6 :

Right click on the spring boot application class and run as ‘java application’ . After the successful start of the application, you will see output like below

Step 7 :

Test the application