How to Make a Simple RestController in Spring Boot?
Last Updated : 16 Jan, 2026
In Spring Boot, a RestController is used to create RESTful web services that return JSON or XML responses. It combines the functionality of @Controller and @ResponseBody, making it easy to handle HTTP requests and send responses without writing boilerplate code.
@RestController eliminates the need to annotate each method with @ResponseBody.
It is ideal for building APIs for web or mobile applications.
Steps to Create a Simple RestController in Spring Boot
Step 1: Create a New Spring Boot Maven Project
Open IntelliJ IDEA.
Click on New Project.
Select Spring Initializr and click Next.
Enter the project details:
Group Id: com.geeksforgeeks
Artifact Id: springboot-restcontroller
Project Type: Maven
Packaging: jar
Java Version: 17
Click Next.
Select the required dependency:
Spring Web
Click Finish to create the project.
After completing these steps, IntelliJ IDEA will generate a Spring Boot Maven project with all required configurations.