Multiple modules let you enforce dependency direction at compile time, build in parallel and incrementally, test each piece in isolation, and keep a clean seam for later extraction into a service.
A common layered layout is common (shared DTOs/utils), domain (entities and pure domain logic, no framework), infrastructure (JPA repos, external clients), application (use cases orchestrating domain and infra), web (controllers and security), and an app module with the Spring Boot main class and resources. The point is the domain can't import the web layer because the Maven graph forbids it, so architectural rules become buildable constraints rather than wiki conventions.
- Splitting into modules without clear dependency direction.
- Creating circular module dependencies.