spring-boot-clean-architecture
Installation
SKILL.md
Clean Architecture In Spring Boot
Place every class on exactly one side of the dependency rule and keep framework types out of the innermost ring. Spring makes the rule easy to violate silently because component scanning wires everything into one container, so the rule must be enforced by package layout and architecture tests rather than by discipline. When the domain is trivial, say so and ship the layered version instead of a rewrite.
When to use
- Deciding whether a class belongs in
domain,application,adapter, orconfig. - Business rules currently import
jakarta.persistence,org.springframework, orjakarta.servlettypes. - A
@Servicecalls business logic on a@Entity, or a@RestControllercontains arithmetic or branching. - A JPQL string,
EntityManager, or@Queryis needed to run a use case. - A migration is needed from a flat annotated service layout, without a rewrite.
- The question is whether Clean Architecture is worth the cost, or which subset of it pays.