레이어드
레이어드 읽기는 익숙한 Spring Boot 계층을 생성합니다: 엔티티, DTO, 매퍼, 리포지터리, XxxCoreService + XxxService,
컨트롤러 - @expose 를 붙인 모든 엔티티마다(@service 는 컨트롤러 제외).
| 번들 | 언제 |
|---|---|
jpa-springboot | architecture = 'layered', Java - 2.x 와 같은 출력(이력에 적은 2.x 버그 수정 제외), 풀 리퀘스트마다 검사 |
jpa-springboot-v3 | 같은 것에 -Pv3: 실제 쓰는 import 만, 규칙이 쓰는 클래스 애노테이션, v3 번들의 권한 검사·쓰기 경로 검사·problem+json 응답 |
jpa-springboot-kt | language = 'kotlin' |
패키지 배치
기준 프로젝트 elasticore-template 은 env.yml 에 패키지를 하나씩 적습니다:
blueprint/content/env.yml (elasticore-template)
namespace:
entity: io.elasticore.blueprint.domain.content.entity
dto: io.elasticore.blueprint.domain.content.dto
enumeration: io.elasticore.blueprint.domain.content.enums
repository: io.elasticore.blueprint.domain.content.repository
service: io.elasticore.blueprint.domain.content.service
control: io.elasticore.blueprint.domain.content.controller
port: io.elasticore.blueprint.domain.content.port
entity/ JPA 엔티티 + Q 클래스 (Specification 메타)
dto/ DTO, KeyDTO, SrchDTO, Mapper
repository/ Spring Data JPA 리포지터리
service/ CoreService (관리) + Service (내 것)
controller/ REST 컨트롤러
enums/ enum 클래스
2.x 호환 출력이 하지 않는 것
jpa-springboot 는 2.x 출력을 지키므로 3.0 의 도메인 규칙이 들어 있지 않습니다: @access, @owner, @password 를
강제하지 않고(생성기가 ... which the selected rules do not enforce 로 경고), states:, @compute, @snapshot 도
생성하지 않습니다. Kotlin 의 jpa-springboot-kt 는 @access, @owner, @password 를 강제하지만 states:,
@compute, @snapshot 은 아닙니다. 이것들은 DDD 나 헥사고날이 필요합니다.
언제 고르나
- 3.0 으로 올린 2.x 프로젝트가 지금 출력 그대로 규칙 엔진을 쓰고 싶을 때.
- 애그리거트, 잠긴 루트, 포트가 더할 것이 없는 단순 CRUD.
예제
elasticore-template- 2.x 기준 프로젝트. 생성 소스가 호환 검사의 골든 파일입니다.elasticore-template-kt- Kotlin,language = 'kotlin'. 대부분의 도메인이env.yml에서jpa-springboot-kt에 DDD 규칙을 더하고 (rules: [jpa-springboot-kt, ddd-aggregate, ddd-reference, ddd-value-object-kt]),shop도메인은hexagonal-springboot-kt를 씁니다.