Spring Boot simplifies Java application development by providing auto-configuration, embedded servers, and minimal setup requirements. Developers can quickly create and run applications without manually configuring external servers like Tomcat.
- Provides embedded Tomcat server for running applications directly
- Supports Maven and Gradle for dependency management
- Easy to run applications using Eclipse, IntelliJ IDEA, or STS
Run Spring Boot Application in Eclipse IDE
Eclipse is a widely used Java IDE that supports Spring Boot development with plugins and Maven integration.
Prerequisites: Download and Install Eclipse.
Step 1: Create or Import a Spring Boot Project
Create a Spring Boot project using Spring Initializr or import an existing project into Eclipse IDE.
Step 2: Add Spring Web Dependency
Add the following dependency in your pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Step 3: Create a Controller Class
Create a package named controller and add the following class.
- @RestController is used to create RESTful web services.
- @GetMapping("/hello") maps the /hello URL to the method.
package com.example.demo.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DemoController {
@GetMapping("/hello")
public String helloWorld() {
return "Hello World!";
}
}
Step 4: Run the Application
Open the main application class and run it.
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
To run the application, click on the green icon as seen in the below image.

After successfully running the application, you can see the console as shown in the below image. Your Tomcat server started on port 8989.

- The embedded Tomcat server will start (e.g., on port 8989).
- Visit: http://localhost:8989/hello ->You’ll see Hello World!

Run Spring Boot Application in IntelliJ IDEA
IntelliJ IDEA provides excellent support for Spring Boot applications with built-in Maven and Gradle integration.
Prerequisite: Step by Step guide to install Intellij Idea.
Step 1: Create or Import a Spring Boot Project
Create a Spring Boot project using Spring Initializr or open an existing project in IntelliJ IDEA.
- IntelliJ automatically downloads required dependencies.
- The main class is generally named DemoApplication.java.

Step 2: Run the Spring Boot Application
Method 1: Right-click DemoApplication.java -> Run 'DemoApplication.main()'.
Shortcut: Ctrl + Shift + F10 (Windows/Linux).

Method 2: Click the green Run icon in the toolbar.

Step 3: Run Application
After successfully running the application, you can see the console as shown in the below image. Your Tomcat server started on port 8080.

The default port of the Tomcat server is 8080.
Step 4: Change the Server Port
Open the application.properties file and add:
server.port=8989
Re-run the application. Now access the application using:
http://localhost:8989/hello

Run Spring Boot Application in Spring Tool Suite
Spring Tool Suite (STS) is an IDE built specifically for Spring development, based on Eclipse.
Prerequisite: How to Download and Install Spring Tool Suite.
Step 1: Create or Import the Project
- Create a new Spring Boot project in STS
- STS provides direct Spring Boot project support.
Step 2: Import Existing Project into STS
- Go to File -> Open Project from File System.
- Select your project directory and click Finish.


After successfully creating or importing the spring boot project a file name Application.java (Here DemoApplication) will be created automatically and this is your entry point. You can consider it as the main method of a Spring Boot application.

Step 3: Run the Application
- Open DemoApplication.java.
- Right-click ->Run As ->Spring Boot App.

After successfully running the application, you can see the console where the Tomcat server starts on default port number 8080 as shown in the below image. By default, STS starts on port 8080.

Step 5: Change the Server Port
Open application.properties and add:
server.port=8989
Now re-run the application again and you can see Your Tomcat server started on the port that you have given like the below image.

If you are encountered with the following error then it is highly recommended that you should change your port number.
