It is time to build something. In this chapter, you will set up your first Spring Boot project: a ready-to-run web application.
Spring Boot removes much of the manual server and framework configuration that older Java web applications needed. That means you can focus on writing API logic. By the end of this page, you will have a running server that responds to HTTP requests, ready to be build on in Writing Endpoints chapter.
Spring is a comprehensive Java framework for building applications. It provides core features like:
ApplicationContext
Spring is powerful, but older Spring projects often required a lot of manual configuration: XML files, bean definitions, external server setup, and many decisions before you could write your first endpoint. That flexibility is useful in large systems, but it can feel heavy when you are getting started.
That is where Spring Boot comes in.
Spring Boot is an opinionated* layer built directly on top of the Spring Framework to dramatically simplify the process of creating, configuring, and running production-ready Java applications.
<aside> 💡
Opinionated means Spring Boot makes sensible default choices for you: which server to use, how to configure JSON serialization, where to scan for components, and how to start the application. You can override these defaults when needed, but you often do not have to.
</aside>
Spring Boot uses auto-configuration based on the dependencies you add. If your project includes the web dependency, Spring Boot can configure an embedded web server, Spring MVC, JSON handling, and other pieces that a REST API needs.
This is why a Spring Boot application can start with a small main() method and a single @SpringBootApplication annotation. You’ll see that shortly.
A typical Spring Boot project is a standard Java application with a few established conventions. We will use Spring Initializr to generate the project, but it helps to understand what we are asking it to create.
Let’s go through our requirements in reverse. We want to build a REST API that:
GET, POST, PUT, and DELETE for our resource on locatable URLs.We have a checklist, let’s take a look how the Spring Initializr tool helps us generate all of it!
Spring Initializr is a tool for generating a starter Spring Boot project. It creates the directory structure, build configuration, application class, and adds the dependencies you need for a specific feature (Eg: Spring Web, Lombok, etc…).
Spring Initializr is available at start.spring.io.
https://www.youtube.com/watch?v=gJrjgg1KVL4&t=715s
<aside> 💭
Watch only from 11:55 to 13:44 to see the Spring Initializr UI flow.
Please ignore the part about doing this within IntelliJ for now. You can use that as a shortcut later as long as you know what it’s a shortcut for.
</aside>
Now we can generate our very first project!
net.hackyourfutureWeekFourRestAPInet.hackyourfuture.WeekFourRestAPIjarYAML
Once you have selected the options, click Generate. This downloads a .zip file.
Extract the .zip file. Then continue with the import steps below.
Now that you have the generated project on disk, import it into IntelliJ:
Open IntelliJ IDEA
Go to File → Open
In the File Dialog, find the unzipped project folder and select the root folder. The root folder is the one containing pom.xml
With the root folder selected, click Open

Root folder “WeekFourRestAPI” is selected
If IntelliJ IDEA asks whether to trust the project, click Trust Project

If IntelliJ IDEA detects the project as a Maven project, you will see Maven as an extra tool window in the sidebar:

Wait for Maven to download dependencies. You may see progress at the bottom of the window. The first import can take a minute.
Verify your JDK is configured: File → Project Structure → Project → SDK should match your installed Java version, Java 25.

Once indexing completes, expand the project folder structure in the left panel. We’ll verify the folder structure shortly.

<aside> ⚠️
</aside>
In Unit Testing with JUnit , you added JUnit to pom.xml manually and reloaded Maven. This time, Spring Initializr already added JUnit and other useful dependencies for you.
Maven reads pom.xml and downloads the dependencies. On first import this is done automatically. Later, adding or changing dependencies, make sure to reload the Maven project. You get popup for that in IntelliJ when you change pom.xml :

Maven reload popup
Spring Web is a feature dependency. It brings in the pieces your application needs to be web-ready:
<aside> ⚠️
</aside>
Below is the folder structure created by Spring Initializr for your Spring Boot project.
📂 WeekFourRestAPI/
├── 📂 src/
│ ├── 📂 main/
│ │ ├── 📂 java/
│ │ │ └── 📂 net/hackyourfuture/WeekFourRestAPI/
│ │ │ └── 📄 WeekFourRestApiApplication.java
│ │ └── 📂 resources/
│ │ └── application.yaml
│ └── 📂 test/
│ └── 📂 java/
│ └── 📂 net/hackyourfuture/WeekFourRestAPI/
│ └── 📄 WeekFourRestApiApplicationTests.java
├── 📄 pom.xml
├── 📄 HELP.md # Helpful documentation by Spring with useful commands and tips
├── 📄 .gitignore, .gitattributes
└── 📄 mvnw, mvnw.cmd
src/main/java/: Your application code lives here: controllers, services, models, and configuration classes.src/main/resources/: Configuration files and static resources live here. application.yaml is the main configuration file.src/test/java/: Your test code lives here, like in Unit Testing with JUnitpom.xml: Maven configuration with project metadata, dependencies, and build settings.mvnw / mvnw.cmd: Maven Wrapper scripts. They let you run Maven commands without installing Maven globally. You will mostly use IntelliJ’s Maven support, but the wrapper is useful for terminal commands and CI/CD pipelines.HELP.md: generated Spring documentation with useful links and commands.@SpringBootApplicationIn WeekFourRestApiApplication.java , you have the runnable main class:
package net.hackyourfuture.WeekFourRestAPI;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WeekFourRestApiApplication {
public static void main(String[] args) {
SpringApplication.run(WeekFourRestApiApplication.class, args);
}
}
@SpringBootApplication is a meta-annotation. That means it combines multiple annotations into one convenient annotation.
The three important annotations included by @SpringBootApplication are:
@Configuration: marks the class as a source of Spring configuration.