Open In App

How to Run Spring Boot Application?

Last Updated : 19 Aug, 2025
Comments
Improve
Suggest changes
5 Likes
Like
Report

Spring Boot is built on top of the Spring framework and provides all of Spring’s features with minimal configuration. It has become a favorite among developers because it offers a production-ready environment, allowing them to focus on business logic instead of complex setup. As a microservice-based framework, Spring Boot enables rapid development of production-grade applications.

In this article, we will learn how to run a Spring Boot application in three popular IDEs:

  • Eclipse IDE
  • IntelliJ IDEA
  • Spring Tool Suite (STS)

1. Run Spring Boot Application in Eclipse IDE

Eclipse is a widely used Java IDE and supports Spring Boot development with ease.

Prerequisite: Download and Install Eclipse.

Step-by-Step Implementation

Step 1: Create and Setup Spring Boot Project in Eclipse IDE

One should know how to create and set up Spring Boot Project in Eclipse IDE and create your first Spring Boot Application in 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

Inside your project, create a package named controller and add DemoController.java:

Java
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!";
    }
}

We have used the below annotations in our controller layer. Here in this example, the URI path is /hello.

  • @RestController: Combines @Controller and @ResponseBody, used to create RESTful web services.
  • @RequestMapping / @GetMapping: Maps HTTP requests to handler methods.
  • Return Type: Returned data is written directly to the HTTP response body (usually JSON or plain text).

Step 4: Run the Application

  • Open DemoApplication.java and run it:
Java
@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. 

Run the application

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

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

2. Run Spring Boot Application in IntelliJ IDEA

IntelliJ IDEA, developed by JetBrains, is a powerful IDE with excellent support for Spring Boot.

Prerequisite: Step by Step guide to install Intellij Idea.

Step 1: Create a Spring Boot Project with IntelliJ IDEA

Create a new Spring Boot project or import one. IntelliJ generates a main class like DemoApplication.java 

Main Class File

Step 2: Run the Spring Boot Application

Method 1: Right-click DemoApplication.java -> Run 'DemoApplication.main()'.

Shortcut: Ctrl + Shift + F10 (Windows/Linux).

Run Application

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

Right click then Run

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

Application Started

The default port of the Tomcat server is 8080 and can be changed in the application.properties file by using this following line of code.

server.port=8989

Step 4: Now re-run the application again and you can see that your Tomcat server has started on the port that you have given, like in the below image.

application.properties

You can access the output screen from the following URL: http://localhost:8989/

3 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 Project.

Step 2: How to Import the Project into Your STS IDE?

  • Go to File -> Open Project from File System.
  • Select your project directory and click Finish.
Open Project


Import Project

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. 

Main Class

Step 3:Run the Application

  • Open DemoApplication.java.
  • Right-click ->Run As ->Spring Boot App.
Run Main Method

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. 

Application Started

By default, STS starts on port 8080. To use a custom port, update application.properties:

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.

Tomcat Server Started

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

Change Port Number

Note: You can access the output screen in the following URL: http://localhost:8080/. Note that at last provide your port number. 


Article Tags :

Explore