Explore the Project Structure

In the previous lesson, we generated our blog application using Spring Initializr.

Now, we'll explore the project structure and understand how different components fit together.

Project Dependencies

The pom.xml file defines our project's dependencies and configuration.

Let's examine the key dependencies we included:

<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> </dependencies>

Project Structure

Spring Boot follows a conventional project structure that promotes organization and maintainability.

The main application components are organized under src/main/java/com/devtiro/blog/:

src/main/java/com/devtiro/blog/ ├── BlogApplication.java ├── controllers/ <= We'll create this later ├── services/ <= We'll create this later ├── repositories/ <= We'll create this later ├── domain/ <= We'll create this later └── config/

The BlogApplication.java file serves as our application's entry point:

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

Build the Project

To make sure our project is set up correctly, we can use Maven to build and run tests.

Open a terminal in your project directory and run:

# Windows .\mvwn clean install # *nix ./mvnw clean install

Summary

  • The pom.xml file manages project dependencies including Spring Web, JPA, and PostgreSQL
  • The @SpringBootApplication annotation enables auto-configuration and component scanning and mark our application as a Spring Boot application
© 2026 Devtiro Ltd. All rights reserved