Project structure and pom.xml
Spring Boot relies on conventions: put a file in the right folder and the framework finds it on its own. So it matters to know what goes where. The main build file is pom.xml: it lists the project's libraries.
Folders
| Path | What lives there |
|---|---|
src/main/java/com/example/blog/ | Application Java code |
src/main/resources/application.properties | Settings |
src/main/resources/static/ | Static files: CSS, images, JS — served as is |
src/main/resources/templates/ | Thymeleaf HTML templates |
src/main/resources/db/migration/ | Flyway SQL migrations |
src/test/java/com/example/blog/ | Tests |
target/ | Build output — created by Maven, not added to Git |
A new project has no static, templates or db/migration folders — we will create them when we reach the matching lessons.
The parent POM
<!-- pom.xml -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.1</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>blog</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>25</java.version>
</properties>The project inherits settings from spring-boot-starter-parent. The parent knows matching versions of hundreds of libraries, so the dependencies below have no versions. The java.version property sets the Java version for compilation.
Starters
<!-- pom.xml -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>A starter is a bundle dependency. spring-boot-starter-webmvc brings in Spring MVC, the embedded Tomcat and the Jackson library for JSON. The second starter with <scope>test</scope> is only for tests and does not end up in the finished application.
In Spring Boot 4 every module has its own pair of starters: the main one and a -test one. For example, spring-boot-starter-data-jpa and spring-boot-starter-data-jpa-test.
The build plugin
<!-- pom.xml -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>This plugin adds the spring-boot:run command and packages the application into a single executable JAR file with all libraries inside.
How to add a dependency
When the course needs a new module, we will add its <dependency> block to pom.xml. After the edit your IDE offers to reload the Maven project, and ./mvnw spring-boot:run downloads the new libraries itself. The block is easy to get from start.spring.io: the Explore button shows the ready pom.xml for the chosen modules.
Common mistake
If you set a starter's version by hand, for example <version>3.5.0</version>, the project gets libraries from different Spring Boot releases. It may compile but fail at startup with an error such as NoSuchMethodError or ClassNotFoundException. Dependencies from Spring Boot have no version — the parent sets it.