Spring Initializr
The Spring Initializr at start.spring.io is the canonical way to scaffold a Spring Boot project. Instead of copying a pom.xml from an old project and hoping the versions still align, you select your options and download a ready-to-build skeleton with the correct parent, plugins, and starter dependencies wired in.
What the Initializr generates
A generated project is a complete, runnable skeleton: a build file (pom.xml or build.gradle), a src/main/java tree with your main class, a src/test/java tree with a context-load test, an application.properties file, and the Maven or Gradle wrapper. You can build and run it immediately, no further setup required.
Choosing project metadata
The web UI groups choices into a few sections. Each maps directly to a field in the generated build file.
| Field | Meaning | Typical value |
|---|---|---|
| Project | Build tool | Maven or Gradle (Groovy/Kotlin) |
| Language | JVM language | Java |
| Spring Boot | Boot version | Latest stable 3.5.x (avoid SNAPSHOT) |
| Group | Reverse-domain group id | com.devcraftly |
| Artifact | Project/artifact name | demo |
| Name | Display name | demo |
| Package name | Root package | com.devcraftly.demo |
| Packaging | Output artifact type | Jar (default) or War |
| Java | Language level | 17, 21, or 24 |
Note: Choose Jar packaging unless you must deploy to an external application server. A jar runs with the embedded server via
java -jar, which is what you want for containers and cloud platforms. See running & packaging.
Java version and packaging
Spring Boot 3.x requires Java 17 or newer. Pick the version your runtime actually uses, the Initializr writes it into the build file as the compiler target. Packaging controls the artifact: Jar embeds Tomcat; War produces a deployable archive and adds the servlet initializer so the app can run both standalone and on an external server.
Selecting dependencies
Click Add Dependencies and search by name. Each entry corresponds to a Spring Boot starter or a curated library. Common choices:
- Spring Web —
spring-boot-starter-webfor REST APIs and MVC. - Spring Data JPA —
spring-boot-starter-data-jpafor relational persistence. - H2 Database — an in-memory database for development.
- Lombok — boilerplate-reducing annotations.
- Validation —
spring-boot-starter-validation(Bean Validation). - Spring Boot DevTools — fast restarts during development (see DevTools).
Tip: Add only what you need now. Dependencies are trivial to add later by editing the build file, and a lean classpath means faster startup and fewer auto-configurations to reason about.
Generating from the command line
The Initializr also serves project ZIPs over HTTP, so you can scaffold without the browser. This is great for scripts and reproducible setups.
curl https://start.spring.io/starter.zip \
-d type=maven-project \
-d language=java \
-d bootVersion=3.5.0 \
-d javaVersion=21 \
-d packaging=jar \
-d groupId=com.devcraftly \
-d artifactId=demo \
-d name=demo \
-d packageName=com.devcraftly.demo \
-d dependencies=web,data-jpa,h2,lombok \
-o demo.zip && unzip demo.zip -d demo
Output:
% Total % Received % Xferd Average Speed Time
100 XXXXX 100 XXXXX 0 0 XXXXX 0 0:00:01
Archive: demo.zip
creating: demo/
inflating: demo/pom.xml
inflating: demo/mvnw
creating: demo/src/main/java/com/devcraftly/demo/
inflating: demo/src/main/java/com/devcraftly/demo/DemoApplication.java
...
You can list the available dependency ids and supported versions by hitting the service metadata:
curl https://start.spring.io/dependencies
The Spring Boot CLI offers an even shorter form with spring init --dependencies=web,data-jpa demo, which calls the same service.
Inside the generated pom.xml
For a Maven project with Web, JPA, H2, and Lombok, the Initializr produces a pom.xml like this.
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.0</version>
<relativePath/>
</parent>
<groupId>com.devcraftly</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
A few things to notice:
- The
<parent>isspring-boot-starter-parent, which provides dependency management (a BOM) so the starters need no explicit versions. spring-boot-starter-testis added automatically withtestscope.- The
spring-boot-maven-pluginis what repackages your build into an executable fat JAR. - Lombok is marked
<optional>true</optional>because it is only needed at compile time.
Warning: Do not delete the
<relativePath/>element or change the parent version casually. The parent’s BOM is what keeps your transitive dependency versions consistent, the heart of how Boot avoids classpath conflicts.
Next steps
With a project scaffolded, the natural next move is to add a controller and run it. See your first application for the minimal Hello World, and compare build tools in Maven vs Gradle.