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, or config.
  • Business rules currently import jakarta.persistence, org.springframework, or jakarta.servlet types.
  • A @Service calls business logic on a @Entity, or a @RestController contains arithmetic or branching.
  • A JPQL string, EntityManager, or @Query is 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.

When not to use

Installs
1
First Seen
Oct 25, 2026
Security Audits