spring-boot-mvc-architecture

Implements layered Spring Boot MVC architecture with entities, repositories, services, mappers, and controllers.

Updated Apr 18, 2026
One-click install
npx skills add https://github.com/heiherilala-vawd/ompany-Management --skill spring-boot-mvc-architecture-heiherilala-vawd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-boot-mvc-architecture
Source: https://github.com/heiherilala-vawd/ompany-Management/tree/main/.agents/skills/spring-boot-mvc-architecture
Command: npx skills add https://github.com/heiherilala-vawd/ompany-Management --skill spring-boot-mvc-architecture-heiherilala-vawd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up a consistent, layered architecture for each new domain in a Spring Boot application is repetitive and error-prone. This Skill provides complete code templates for the full MVC stack so every new entity follows the same conventions for layering, pagination, auditing, and security. ## Core Features & Use Cases - Full Layer Templates: Generates Entity, Repository, DAO (CriteriaBuilder), Service, Mapper, and Controller classes following the Controller → Mapper → Service → Repository → Entity pattern. - Secure Pagination & Audit Fields: Includes BoundedPageSize and PageFromOne value objects, PageUtils, and a CreatAndUpdateEntity base class with automatic created/updated by/at tracking via ModificationUtils. - Crupdate Convention: Implements a combined create-or-update PUT endpoint with role-based access control using @PreAuthorize. - Use Case: When adding a new domain entity (e.g., Warehouse) to a Spring Boot project, use this Skill to scaffold the entire stack from JPA entity to secured REST controller with pagination in one pass. ## Quick Start Use the spring-boot-mvc-architecture skill to create the full MVC stack for a new Warehouse entity in my Spring Boot project.

Frequently Asked Questions about spring-boot-mvc-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Spring Boot project with layered architecture?

Organize code into Controller, Mapper, Service, Repository, and Entity layers where each layer has a single responsibility. Controllers handle HTTP requests, mappers convert between DTOs and domain models, services hold business logic, and repositories manage data access via Spring Data JPA.

How to implement pagination in Spring Boot REST API?

Use Pageable with PageRequest.of(page, size) in the repository layer, and validate inputs with value objects like BoundedPageSize that enforce a maximum page size. Convert one-based page numbers from clients to zero-based Spring Data indexes in a utility class.

What is the difference between JpaRepository and JpaSpecificationExecutor?

JpaRepository provides standard CRUD and pagination methods, while JpaSpecificationExecutor adds support for dynamic queries using the Criteria API. For fully custom filtered queries, implement a DAO with EntityManager and CriteriaBuilder.

How do I add automatic audit fields to JPA entities?

Create a @MappedSuperclass base entity with @CreationTimestamp and @UpdateTimestamp fields for createdAt and updatedAt, plus createdBy and updatedBy user references. Populate the user fields in the service layer from the Spring Security authentication context.

When should I use a combined create-or-update PUT endpoint?

Use the crupdate pattern when clients can submit entities that may or may not already exist, identified by client-provided IDs. The service checks whether each ID exists in the database and either updates the existing record or creates a new one in a single transaction.