Tutorial: Build a Spring Boot REST API
In this tutorial, you will build a photo-sharing REST API with Spring Boot in IntelliJ IDEA.
You will learn how to:
Create and run a Spring Boot project with Spring Initializr in IntelliJ IDEA, and add a controller that responds in the browser.
Add REST endpoints that handle GET and DELETE requests and return JSON, with a model and a service behind them.
Upload and download files: receive files in multipart POST requests and return them as file downloads.
Store data in an H2 database with Spring Data JDBC, then package the application as an executable JAR and run it outside the IDE.
Each part continues the same project. The checklist at the beginning of each part marks the earlier parts as completed.
If you only need a minimal application with one endpoint, refer to Tutorial: Create your first Spring application.
Prerequisites
Basic knowledge of Java and HTTP. No Spring experience is required.
JDK 17 or later. This tutorial uses Spring Boot 4, which requires Java 17 as a minimum. If no JDK is installed, you can download one when you create the project.
A web browser (such as Chrome or Safari) with developer tools. You will use the browser console to send a DELETE request.
The Spring and Spring Boot plugins, bundled and enabled by default in IntelliJ IDEA.
To check that they are enabled, open (Ctrl+Alt+S), search for Spring and Spring Boot, and make sure that the checkboxes next to the plugins are selected.