📘 Premium Read: Access my best content on
Medium member-only articles
— deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed.
Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount):
Explore My Udemy Courses
— Learn through real-time, project-based development.
Spring Boot makes Java application development simple and efficient. With Spring Initializr, you can quickly set up a project, and using the free IntelliJ IDEA Free Community Edition, you can start coding immediately. In this guide, we’ll show you how to create a Spring Boot project, import it into IntelliJ IDEA, and build a simple REST API.
YouTube Video
We recommend watching the YouTube video below to learn how to create a Spring Boot project in IntelliJ IDEA (Free Community Edition) IDE using Spring Initializr and build Spring Boot REST API:
What You’ll Need
Java Development Kit (JDK 23): Download and install JDK 23 from Oracle or OpenJDK.
Verify the installation:
java -version
IntelliJ IDEA Community Edition: Download the free version of IntelliJ IDEA from JetBrains.
Step 1: Create a Spring Boot Project with Spring Initializr
Visit Spring Initializr: Go to Spring Initializr in your web browser.
Fill in Project Details:
Group: com.example
Artifact: spring-boot-rest-api
Name: SpringBootRestApi
Packaging: Jar
Java Version: 23
Add Dependencies:
Click Add Dependencies and select:
Spring Web: To build REST APIs.
Spring Boot DevTools: For hot-reloading during development.
Download the Project:
Click Generate to download the project as a ZIP file.
Extract the ZIP File: Extract the downloaded project to a folder (e.g., C:\Projects\SpringBootRestApi).
Step 2: Open the Project in IntelliJ IDEA
Launch IntelliJ IDEA:
Open IntelliJ IDEA Community Edition.
Open the Project:
From the IntelliJ welcome screen, click Open.
Navigate to the folder where you extracted the Spring Boot project and select it.
Wait for Dependencies:
IntelliJ will automatically detect the pom.xml file (Maven project) and download the necessary dependencies.
SpringBootRestApiApplication.java: The main class for your Spring Boot application.
application.properties: Configuration file for the application.
pom.xml: Maven’s configuration file to manage dependencies.
Step 4: Create a Simple REST API
Create a Controller:
Inside the com.example.springbootrestapi package, right-click and select New > Java Class.
Name the class HelloController.
Add REST API Code:
Open HelloController.java and paste the following code:
package com.example.springbootrestapi;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/")
public String sayHello() {
return "Welcome to Spring Boot 3!";
}
}
Step 5: Run the Application
Run the Application:
Open the SpringBootRestApiApplication.java file.
Right-click and select Run 'SpringBootRestApiApplication'.
Verify the API:
Once the application starts, open your browser and go to:
http://localhost:8080/
You should see the message:
Welcome to Spring Boot 3!
Conclusion
You’ve successfully created a Spring Boot project, imported it into IntelliJ IDEA, and built a REST API. This basic setup can now be expanded to include more features, such as additional endpoints, services, or database connections. Happy coding!
Related Spring Boot and Microservices Tutorials/Guides:
Comments
Post a Comment
Leave Comment