skip to content

spring-boot-starter-parent

spring-boot-starter-parent supplies managed versions plus plugin configuration, Java version, encoding and resource filtering — and you give all of that up if your build needs a different parent. Interviewers ask what you would do in a company with its own parent POM.

part ofSpring Frameworkoverview, primer and where to startread it →
on this pageshow

questions

5

What is spring-boot-starter-parent and why do Spring Boot projects use it as their Maven parent?

level: juniorimportance: must knowfreq 70%

answer

  1. Parent POM = curated defaults
  2. Extends spring-boot-dependencies BOM
  3. Versions + Java + UTF-8 + plugins
  4. repackage bound to package
  5. Everything overridable

basics

~20 s

It is a special Maven parent POM you inherit from. It sets sensible defaults for you: dependency versions, a Java version, UTF-8 encoding, and it configures the plugin that builds a runnable Spring Boot jar — so you write far less pom.xml.

solid answer

~40 s

spring-boot-starter-parent is a curated Maven parent POM. By putting it in <parent>, your project inherits: (1) dependency version management (it itself extends spring-boot-dependencies, a big BOM, so you list dependencies without <version>); (2) a default Java compiler version via the java.version property; (3) UTF-8 source and resource encoding; (4) resource filtering with @...@ delimiters; and (5) pluginManagement that pre-configures common Maven plugins, including the spring-boot-maven-plugin with its repackage goal bound to the package phase so `mvn package` yields an executable fat jar. The net effect is a tiny, consistent pom.xml. You can override any inherited default (e.g. <java.version>21</java.version>) in your own properties.

code

kotlin · 20 lines
kotlin
// Minimal Maven pom via the parent (shown as XML in a comment for clarity):
//
// <parent>
//   <groupId>org.springframework.boot</groupId>
//   <artifactId>spring-boot-starter-parent</artifactId>
//   <version>3.3.0</version>
//   <relativePath/>
// </parent>
//
// <properties>
//   <java.version>21</java.version>   // override the inherited default
// </properties>
//
// <dependencies>
//   <dependency>
//     <groupId>org.springframework.boot</groupId>
//     <artifactId>spring-boot-starter-web</artifactId>
//     <!-- no <version>: managed by the inherited BOM -->
//   </dependency>
// </dependencies>

go deeper

for a junior

Should know it's a parent POM giving defaults so pom.xml stays small, and that starters need no explicit version.

for a middle

Should enumerate the concrete things inherited: BOM versions, java.version, UTF-8, plugin management, repackage wiring.

for a senior

Should explain the parent→spring-boot-dependencies chain and the override model, plus the one-parent constraint.

for a principal

Should frame it as centralized, overridable build governance and know when a corporate parent forces the BOM-import alternative.

## What it is `spring-boot-starter-parent` is a **Maven parent POM** published by the Spring Boot team. In Maven, a project can declare a `<parent>` and inherit that parent's configuration (properties, dependency management, plugin management, build settings). Spring Boot ships this parent so a typical app's `pom.xml` can be very small. ```xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.3.0</version> <relativePath/> </parent> ``` ## What you inherit 1. **Dependency version management.** `spring-boot-starter-parent` itself has `<parent>` = `spring-boot-dependencies`, which is a **BOM** (Bill of Materials): a POM whose `<dependencyManagement>` pins the versions of hundreds of libraries (Spring, Jackson, Hibernate, JUnit, etc.). Because you inherit that, you can declare `spring-boot-starter-web` with **no `<version>`** — the version comes from the managed list. This prevents version conflicts across the ecosystem. 2. **Java version.** The parent defines a `java.version` property (a default). Setting `<java.version>21</java.version>` in your `<properties>` feeds Maven's compiler configuration (`maven.compiler.release`/`source`/`target`), telling `maven-compiler-plugin` which JDK level to compile for. 3. **Encoding.** It sets `project.build.sourceEncoding` and `project.reporting.outputEncoding` to **UTF-8**, so builds are reproducible across machines regardless of the OS default charset. 4. **Resource filtering with `@...@` delimiters.** More on this in a dedicated question — it lets you substitute Maven properties like `@project.version@` into files such as `application.properties` without clashing with Spring's own `${...}` placeholders. 5. **`pluginManagement`.** The parent pre-configures versions and sensible settings for common build plugins (compiler, surefire, failsafe, jar, war, resources, shade, etc.) and — crucially — the **`spring-boot-maven-plugin`**, including an execution that binds its **`repackage`** goal to the `package` phase. So `mvn package` produces the executable, self-contained ('fat') jar. ## Override model Everything is a **default you can override**. Redefine a property (`java.version`, `spring-boot.version`), add plugin config in your own `<build>`, or exclude a managed dependency. Because these live in a parent, changes are centralized and consistent. ## Gotchas - `<relativePath/>` (empty) tells Maven **not** to look for the parent on the local filesystem and to resolve it from the repository — important because this parent is a published artifact, not a sibling module. - You can only have **one** Maven parent. If your organization already mandates a corporate parent POM, you **cannot** also use `spring-boot-starter-parent` — that's the classic reason to switch to the `spring-boot-dependencies` BOM as an *import* instead (covered separately). - Inheriting the parent does **not** add any dependencies to your build — it only *manages* them. You still declare the starters you want.

  • Does inheriting the parent pull in any runtime dependencies by itself?
    No. It only manages versions and plugin config. You still explicitly declare the starters/dependencies you need; the parent just supplies their versions and build wiring.
  • What does the empty <relativePath/> do?
    It disables Maven's default behavior of searching the local filesystem (../pom.xml) for the parent, forcing resolution from the repository since the parent is a published artifact.

saying these in an interview costs you the question

  • Thinking the parent adds Spring dependencies to the classpath automatically
  • Believing you must specify <version> on each starter even with the parent
  • Confusing the parent with the application's own @SpringBootApplication class

context

open as a page

How do the java.version property and encoding settings inherited from the parent affect the build, and how do you change the Java version?

level: middleimportance: should knowfreq 55%

basics

~10 s

The parent sets a default Java level and UTF-8 encoding. To compile for a different JDK, set <java.version>21</java.version> in your <properties>; that flows into the compiler plugin. UTF-8 encoding keeps builds identical across machines.

open as a page

How does inheriting the parent make `mvn package` produce an executable fat jar? Explain the repackage goal wiring.

level: seniorimportance: should knowfreq 45%

basics

~20 s

The parent's plugin management binds the spring-boot-maven-plugin's repackage goal to Maven's package phase. So after Maven builds the plain jar, the plugin rewrites it into a self-contained runnable jar (with nested dependencies and a launcher) automatically.

open as a page

The parent enables resource filtering with @...@ delimiters instead of the default ${...}. Why, and how would you inject the Maven build version into application.properties?

level: seniorimportance: should knowfreq 40%

basics

~10 s

Spring's own config uses ${...} placeholders, which would collide with Maven's filtering. So the parent switches Maven's resource-filtering delimiter to @, letting you write @project.version@ in application.properties while Spring's ${...} stays untouched.

open as a page

Your org mandates a corporate parent POM, so you can't use spring-boot-starter-parent. What's the alternative, and what exactly do you give up?

level: principalimportance: should knowfreq 35%

basics

~20 s

Import the spring-boot-dependencies BOM in <dependencyManagement> with scope=import. You keep managed versions but lose the parent's extras: Java version property, UTF-8 encoding, plugin management, @-delimiter resource filtering, and the automatic repackage wiring — all of which you must configure yourself.

open as a page