본문으로 건너뛰기
WCMS 2 문서
개발자 문서

계층·패키지 규칙

Controller에서 Mapper까지 한 가지 흐름과 금지 목록을 익힙니다.

한 가지 흐름

Controller
  → {기능}CommandService · {기능}QueryService (interface)
  → …ServiceImpl (extends EgovAbstractServiceImpl)
  → 도메인
  → 저장소 interface
  → Mybatis…Repository (extends EgovAbstractMapper) + Mapper XML

계층

계층패키지책임
진입presentation화면·API 요청과 응답
계약application.serviceCommand·Query interface
구현application.service의 …ServiceImpl업무 규칙, 트랜잭션
도메인wcms.domain.{bc}값·규칙·예외
저장소 계약(쓰기)wcms-core/src/main/java/wcms/domain/{bc}/{기능}/repository/{도메인}Repository interface
저장소 계약(읽기)application.repository{대상}QueryRepository interface
저장소 구현infrastructure.persistenceMyBatis Mapper, *Row
응답application.dto*Response, Command

금지

  • presentation에서 저장소·Row·…Impl을 직접 참조하지 않습니다.
  • wcms-user와 wcms-admin이 서로 참조하지 않습니다.
  • 프레임워크 독립 집합(wcms-core 등)에서 Spring·eGov·MyBatis·Servlet을 import하지 않습니다.
  • Mapper XML은 infrastructure.persistence의 *Row에만 매핑합니다. 화면·API는 *Response로 내보냅니다.
  • 테이블 쓰기는 그 테이블을 소유한 BC만 합니다.
  • Enum과 공통코드를 섞지 않습니다.

검사

검사도구
ImportControlwcms-build-config/src/main/resources/wcms/import-control.xml
계층 경계·이름·위치scripts/check_architecture.py, scripts/check_structure.py
검사 약화 방지scripts/check_layer_probes.py
DB 이름 표준scripts/check_data_standard.py
Mapper 문장 짝scripts/check_mybatis_statements.py
프레임워크 독립 컴파일scripts/check_core_compile.py

./gradlew check의 checkstyleMain이 ImportControl을 적용합니다.

다음 단계

이 페이지