How to Create Your First Spring Boot Project (Beginner Tutorial)

Introduction

Now that you know what Spring Boot is, it’s time to build your first real project.
This beginner guide will walk you through creating a Spring Boot application the right way — using Spring Initializr, the official starter tool.

By the end of this tutorial, you will have a fully running Spring Boot app on your machine.


Step 1: Open Spring Initializr

The easiest way to start a Spring Boot project is through:

👉 https://start.spring.io/

Spring Initializr allows you to generate a clean project structure with the dependencies you choose.


Step 2: Project Settings

Configure the following:

Project

  • Maven Project

Language

  • Java

Spring Boot Version

  • Choose the latest stable version (e.g. 3.x.x)

Project Metadata

  • Group: com.example
  • Artifact: demo
  • Name: demo
  • Package: com.example.demo

Step 3: Add Dependencies

Add the following dependencies for a simple beginner project:

Spring Web

(required for REST APIs)

Optional (but recommended for later tutorials):

  • Spring Boot DevTools
  • Lombok

Final list:

  • Spring Web
  • DevTools
  • Lombok

Step 4: Generate the Project

Click Generate → a ZIP file downloads.

Unzip it and open it inside your IDE:

  • IntelliJ IDEA (recommended)
  • Eclipse
  • VS Code

IntelliJ will automatically load the Maven project.


Step 5: Understanding the Project Structure

Your project will look like this:

src/
 └── main/
      ├── java/com/example/demo
      │      └── DemoApplication.java
      └── resources/
             ├── application.properties
             └── static/

DemoApplication.java

The main class that starts your application.

application.properties

Configuration file for your app.


Step 6: Run the Application

From your IDE:

  • Open DemoApplication.java
  • Click Run

Or run from terminal:

mvn spring-boot:run

You’ll see logs ending with:

Started DemoApplication in 2.345 seconds

Your server is now running at:

👉 http://localhost:8080


Step 7: Create Your First REST API

Create a new file:

HelloController.java

Inside:

@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello() {
        return "Hello from Spring Boot!";
    }
}

Visit:

👉 http://localhost:8080/hello

You’ll get:

Hello from Spring Boot!

Congratulations — your first Spring Boot API works!


What You Learned

  • How to generate a Spring Boot project
  • How to run the application
  • How to create your first controller
  • How to expose your first REST endpoint

This is the foundation of every Spring Boot application you will ever build.


Next Recommended Tutorial

Understanding Spring Boot Project Structure & Key Annotations

Previous Article

What Is Spring Boot? A Complete Guide for Beginners

Next Article

Understanding Spring Boot Project Structure & Key Annotations (Beginner Guide)

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨