How to Create Your First Spring Boot Project | The 15-Minute Setup That Changed My Java Journey

Learn to create Spring Boot projects from scratch. Personal guide with common pitfalls, setup tricks, and the exact steps I wish I knew when starting.

I still remember my first day at my previous job when my team lead said, "Just spin up a quick Spring Boot project for the API." I stared at my screen for 20 minutes, frantically googling "how to create Spring Boot project" while pretending to look busy. That embarrassing moment taught me that everyone assumes Spring Boot setup is obvious—but it's not, especially when you're coming from other frameworks.

After creating hundreds of Spring Boot projects and mentoring dozens of developers, I've discovered the exact steps that work every time. More importantly, I'll share the mistakes that cost me hours of debugging, so you can avoid them entirely.

By the end of this guide, you'll have a running Spring Boot application and understand exactly what each piece does. Let's dive in.

Why I Switched to Spring Boot (And Why You Should Care)

Three years ago, I was building Java web applications the traditional way—configuring XML files, managing dependencies manually, and spending more time on setup than actual coding. My projects took hours to configure before I could write a single line of business logic.

Then I discovered Spring Boot. What used to take me 2-3 hours of configuration now takes 15 minutes. The magic isn't just in the speed—it's in the confidence. Every project starts the same way, follows the same patterns, and just works.

Here's what Spring Boot gives you out of the box:

  • Embedded server: No more Tomcat installation headaches
  • Auto-configuration: Sensible defaults for everything
  • Dependency management: No version conflicts
  • Production-ready features: Health checks, metrics, monitoring

Method 1: Spring Initializr (My Go-To Approach)

This is how I create 90% of my Spring Boot projects. Spring Initializr is a web-based tool that generates your project structure with zero configuration errors.

Step 1: Navigate to Spring Initializr

Open your browser and go to start.spring.io. This is Spring's official project generator, and it's been my reliable starting point for years.

Spring Initializr interface showing project configuration options The Spring Initializr interface - your one-stop shop for Spring Boot project creation

Step 2: Configure Your Project Settings

Here are the exact settings I use for most projects, along with why I choose each one:

Project Type: Maven Project

  • I prefer Maven over Gradle for beginners—the learning curve is gentler
  • Maven has better IDE integration in my experience

Language: Java

  • Unless you have a specific reason to use Kotlin or Groovy, stick with Java

Spring Boot Version: 3.1.x (latest stable)

  • Avoid snapshot versions—I learned this the hard way when a snapshot broke our CI pipeline

Project Metadata:

  • Group: com.yourcompany.projectname (I use my GitHub username for personal projects)
  • Artifact: demo-app (this becomes your JAR file name)
  • Name: Demo App
  • Package name: Auto-generated (perfect as-is)
  • Packaging: Jar
  • Java Version: 17 (LTS version—future-proof choice)

Step 3: Add Dependencies (Start Simple)

For your first project, I recommend starting with just these dependencies:

  1. Spring Web - For building REST APIs
  2. Spring Boot DevTools - Auto-restart during development (saves you countless manual restarts)

Selected dependencies in Spring Initializr showing Web and DevTools Start with these two dependencies - you can always add more later

Pro tip from my experience: Resist the urge to add everything. I once added 15 dependencies to a "simple" project and spent two days resolving conflicts. Start minimal, add dependencies as you need them.

Step 4: Generate and Download

Click "Generate" and download the ZIP file. Extract it anywhere on your machine—I keep a dedicated spring-projects folder for organization.

Method 2: Using Your IDE (IntelliJ IDEA)

If you're using IntelliJ IDEA (my daily driver), you can create Spring Boot projects directly from the IDE.

Step 1: Create New Project

  1. Open IntelliJ IDEA
  2. Click "New Project"
  3. Select "Spring Initializr" from the left panel
  4. Choose your project SDK (Java 17 recommended)

Step 2: Configure Project

Use the same settings I mentioned in the Spring Initializr method. IntelliJ's interface is just a wrapper around the same tool.

Step 3: Select Dependencies

Choose "Spring Web" and "Spring Boot DevTools" for now.

Method 3: Command Line with Spring Boot CLI (For the Terminal Enthusiasts)

I don't use this method often, but it's worth knowing for automation scripts or when you're working on a remote server.

First, install Spring Boot CLI:

# On macOS with Homebrew (my setup)
brew tap spring-io/tap
brew install spring-boot

# On Windows with Chocolatey
choco install springbootcli

Then create your project:

spring init --dependencies=web,devtools --java-version=17 --groupId=com.example --artifactId=demo-app demo-app

Project Structure Walkthrough

Once you've generated your project (regardless of method), you'll see this structure:

demo-app/
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── com/example/demoapp/
│   │   │       └── DemoAppApplication.java
│   │   └── resources/
│   │       ├── static/
│   │       ├── templates/
│   │       └── application.properties
│   └── test/
│       └── java/
│           └── com/example/demoapp/
│               └── DemoAppApplicationTests.java
├── pom.xml
└── mvnw, mvnw.cmd

Let me explain what confused me initially:

The Main Application Class

@SpringBootApplication
public class DemoAppApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoAppApplication.class, args);
    }
}

This tiny class does all the heavy lifting. The @SpringBootApplication annotation is actually three annotations combined:

  • @Configuration: Marks this as a configuration class
  • @EnableAutoConfiguration: Tells Spring Boot to auto-configure based on dependencies
  • @ComponentScan: Scans for components in this package and sub-packages

The POM File (pom.xml)

This file manages your dependencies and build configuration. Spring Boot's parent POM handles version management—no more dependency hell.

Application Properties

The application.properties file is where you'll configure your app. Start with this:

# I always set these for local development
server.port=8080
spring.application.name=demo-app

# Useful for debugging (I enable this on every project)
logging.level.com.example.demoapp=DEBUG

Running Your Spring Boot Application

Here's where the magic happens. You have three ways to run your app:

Method 1: IDE Run Button

Click the green arrow next to your main method. This is how I run apps during development—simple and reliable.

Method 2: Maven Command

# From your project root directory
./mvnw spring-boot:run

The mvnw (Maven wrapper) ensures everyone on your team uses the same Maven version. I've avoided countless "works on my machine" issues this way.

Method 3: Java Command

# First, build the JAR
./mvnw clean package

# Then run it
java -jar target/demo-app-0.0.1-SNAPSHOT.jar

This is how you'll run your app in production.

Verifying Your Setup

Once your application starts (it takes about 10-15 seconds), you'll see output like this:

Started DemoAppApplication in 2.847 seconds (JVM running for 3.284)

Terminal output showing successful Spring Boot application startup The satisfying sight of a successful Spring Boot startup

Now open your browser and navigate to http://localhost:8080. You'll see a "Whitelabel Error Page"—this is actually good! It means your server is running. The error happens because we haven't created any endpoints yet.

Creating Your First Endpoint

Let's add a simple REST endpoint to prove everything works. Create a new class called HelloController.java:

package com.example.demoapp;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    
    @GetMapping("/hello")
    public String hello() {
        return "Hello, Spring Boot! This actually works!";
    }
}

Restart your application and visit http://localhost:8080/hello. You should see your message displayed in the browser.

DevTools magic: If you added Spring Boot DevTools, the app will automatically restart when you save files. This feature alone saves me hours every week.

Common Pitfalls I've Encountered (And How to Avoid Them)

Port Already in Use Error

Error: Port 8080 was already in use

Solution: Either stop the other application using port 8080, or change your port in application.properties:

server.port=8081

Java Version Mismatch

Error: UnsupportedClassVersionError

Cause: Your project is configured for Java 17, but you're running Java 11.

Solution: Either upgrade your Java version or change the project configuration to match your installed Java version.

IDE Not Recognizing Spring Boot

Symptoms: No auto-completion, red underlines everywhere

Solution: Make sure you've imported the project as a Maven project, not just opened the folder. In IntelliJ, use "Open" and select the pom.xml file directly.

Next Steps After Your First Project

Now that you have a working Spring Boot application, here's what I recommend exploring next:

  1. Add a database: Start with H2 (in-memory) for simplicity
  2. Create a REST API: Build a simple CRUD application
  3. Add Spring Security: Secure your endpoints
  4. Write tests: Spring Boot's testing support is fantastic
  5. Package for deployment: Learn about profiles and configuration

What This Setup Means for Your Development Journey

Creating your first Spring Boot project is more than just following steps—it's your entry point into modern Java development. This setup gives you:

  • Immediate productivity: No configuration paralysis
  • Industry standards: The same tools used by thousands of companies
  • Scalable foundation: Your simple app can grow into enterprise software
  • Community support: Millions of developers use this exact setup

After helping dozens of developers through their first Spring Boot projects, I've seen the confidence boost this moment provides. You're not just creating a project—you're joining a community of developers who've chosen the same reliable, powerful platform.

The setup we just completed has served me well across startups and enterprise companies alike. Every Spring Boot project I've built in the last three years started with these exact steps. Now you have the same foundation that's powered my career growth and countless successful applications.

Next, I'm exploring Spring Boot 3's native compilation features for even faster startup times—but that's a topic for another deep dive.