Skip to content
Spring Boot introduction 2 min read

Setup & Installation

Getting a Spring Boot project running takes minutes. You need a modern JDK, a build tool, and one of several ways to scaffold the project. This page covers the recommended path and the alternatives.

Prerequisites

Spring Boot 3.x requires Java 17 or newer (Java 21 LTS is a great choice). Verify your toolchain before starting.

java -version

Output:

openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)

Warning: Spring Boot 3.x dropped support for Java 8 and 11. If you are stuck on Java 8, you must stay on the Spring Boot 2.7 line, which is end-of-life.

You also need a build tool. Maven and Gradle are both first-class, and the generated project includes a wrapper (mvnw / gradlew) so a global install is optional.

Generating a project with start.spring.io

The Spring Initializr at start.spring.io is the canonical way to bootstrap a project. Choose:

  • Project: Maven or Gradle
  • Language: Java
  • Spring Boot: the latest stable release
  • Dependencies: e.g. Spring Web, Spring Data JPA, H2 Database

Download the ZIP, unpack it, and open it in your IDE. You can also drive the Initializr from the command line.

curl https://start.spring.io/starter.zip \
  -d type=maven-project \
  -d language=java \
  -d bootVersion=3.3.0 \
  -d javaVersion=21 \
  -d dependencies=web,data-jpa,h2 \
  -d groupId=com.devcraftly \
  -d artifactId=demo \
  -o demo.zip && unzip demo.zip -d demo

Maven vs Gradle

Both work everywhere; the choice is about preference and ecosystem.

AspectMavenGradle
Config formatXML (pom.xml)Groovy/Kotlin DSL
Build speedPredictableFaster (incremental, caching)
Learning curveGentleSteeper
FlexibilityConvention-boundHighly programmable

A Maven pom.xml declares the parent and starters:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.3.0</version>
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

The Gradle equivalent uses plugins and the dependency block:

plugins {
    id 'org.springframework.boot' version '3.3.0'
    id 'io.spring.dependency-management' version '1.1.5'
    id 'java'
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
}

Tip: Notice the starters carry no explicit version. Spring Boot’s dependency management aligns versions for you, which prevents most classpath conflicts.

Running the application

Use the wrapper that ships with the project so everyone builds with the same tool version.

# Maven
./mvnw spring-boot:run

# Gradle
./gradlew bootRun

To produce a runnable artifact and launch it directly:

./mvnw clean package
java -jar target/demo-0.0.1-SNAPSHOT.jar

Spring Boot CLI

For quick experiments, the Spring Boot CLI runs Groovy scripts without a build file. Install it via SDKMAN.

sdk install springboot
spring --version
spring init --dependencies=web,data-jpa my-app

The spring init command is a thin wrapper around the Initializr, handy for scripting project creation. With your project generated and running, the next step is understanding how the code is organized.

Last updated June 1, 2026
Was this helpful?