Run Your First Spring Boot App in VS Code (2025) — Hello World REST API

Want to build powerful Java backend apps but don't want to use heavyweight IDEs like Eclipse or IntelliJ?
In this post, I’ll show you how to quickly set up and run your first Spring Boot REST API directly from Visual Studio Code — with zero clutter and maximum clarity.
✅ What You’ll Build
We’ll create a Spring Boot project and build a simple REST endpoint that returns:
localhost:8080/hello → "Hello, World!"
🧰 Tools Required
Java 17+
Visual Studio Code
Spring Boot Extension Pack
Internet connection
🔧 Step 1: Install Java and Spring Boot Extensions
✅ Install Java 17+
If you haven’t installed Java yet, follow this guide first:
👉 How to Install Java 17 on Windows
Once installed, verify it in the terminal:
java -version
✅ Install Spring Boot Extension Pack in VS Code
Open VS Code
Go to Extensions (or press
Ctrl+Shift+X
)Search for Spring Boot Extension Pack and install it
It includes:
Spring Initializr
Spring Boot support
Java language tools
🐣 Step 2: Create a Spring Boot Project in VS Code
Press
Ctrl+Shift+P
to open the Command PaletteType
Spring Initializr: Create a Maven Project
Follow the prompts:
Language: Java
Group Id:
com.example
Artifact Id:
demo
Name:
demo
Packaging: Jar
Java Version: 17
Dependencies: Spring Web
Choose a folder to save the project
VS Code will prompt: “Do you want to open it?” → Click Yes
✅ You now have a working Spring Boot app scaffold.
✍️ Step 3: Add a REST Controller
- In the
src/main/java/com/example/demo
directory, create a new file:
// HelloController.java
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, World!";
}
}
▶️ Step 4: Run the App
Open a terminal inside VS Code and run:
./mvnw spring-boot:run
OR on Windows:
mvnw.cmd spring-boot:run
Once you see Started DemoApplication
, open your browser and go to:
You should see:
Hello, World!
🎉 That’s It!
You just built and ran your first Spring Boot REST API in VS Code.
Next up, I’ll show you:
How to add error handling
Connect to MySQL database
Build and deploy real apps
🔖 Follow me for clean, silent backend tutorials.
📦 Bonus Resources
💬 Questions?
Drop them in the comments — I reply to all!
#SpringBoot #Java #Backend #VScode #SpringTutorial #HelloWorld #APIs
Subscribe to my newsletter
Read articles from Backend Brew directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
