Category: React • Beginner
Published on 01 Apr 2026
Explanation
Step 1: Install Required Tools 🛠️ — Before creating a Spring Boot app, make sure Java (JDK 17+ recommended), Maven (or Gradle), and an IDE like IntelliJ IDEA or VS Code are installed.
Code Example
java -version mvn -version
Explanation
Step 2: Create a Spring Boot Project 🚀 — Use Spring Initializr (https://start.spring.io/) and select Project: Maven, Language: Java, Spring Boot Version: Latest stable, Dependencies: Spring Web. Download and extract the project.
Code Example
Group: com.example Artifact: demo Dependencies: Spring Web
Explanation
Step 3: Main Application Class ▶️ — This is the entry point of your Spring Boot application. The @SpringBootApplication annotation enables auto-configuration and component scanning.
Code Example
package com.example.demo;
import org.springframework.boot.
SpringApplication;
import org.springframework.boot.
autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(
DemoApplication.class, args);
}
}
Explanation
Step 4: Create a REST Controller 🌐 — Add a simple controller class to handle HTTP requests and return a response.
Code Example
package com.example.demo;
import org.springframework.web.bind.
annotation.GetMapping;
import org.springframework.web.bind.
annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public String sayHello() {
return "Hello Spring Boot!";
}
}
Explanation
Step 5: Run the Application ▶️ — Open terminal in the project folder and run the Spring Boot app using Maven.
Code Example
mvn spring-boot:run
Explanation
Step 6: Test the Application ✅ — Open a browser and visit the endpoint below. You should see the response from your controller.
Code Example
http://localhost:8080/hello