Skip to content

Hexagonal Architecture로 구조화한 멀티모듈 코프링 웹 애플리케이션

License

Notifications You must be signed in to change notification settings

jiniya22/demo-hexagonal

Repository files navigation

demo-hexagonal

Hexagonal Architecture 구조로 만든 코프링 웹 애플리케이션

OpenJDK Kotlin Spring Boot Gradle MariaDB Swagger 3

  1. demo-app (JDK 17 + Kotlin + Spring Boot 2 + Spring MVC + Spring Data JPA)
    1. 프로젝트 구성
    2. Tech Stacks
    3. demo-app
    4. demo-all-in-one-app
  2. demo-reactive (JDK 17 + Spring Boot 2 + Spring WebFlux + Spring Data MongoDB Reactive)
    1. 프로젝트 구성
    2. Tech Stacks
    3. demo-reactive-app

1. demo-app

1.1. 프로젝트 구성

demo-app 프로젝트는 멀티 모듈로 구성되어있습니다.

architecture-1

  • core
    • 헥사고날 아키텍처의 application core 영역에 해당
    • 프로젝트의 핵심적인 비즈니스 로직이 들어있습니다
    • domain, port를 포함하고 있으며, 모든 클래스는 public 접근제한자로 설정되어 있습니다.
  • infrastructure
    • 헥사고날 아키텍처의 adapter - out 영역에 해당
    • datasource에 관련된 모듈이 들어갑니다.
    • persistence adapter, JpaRepository, ORM Entity 가 포함되어있습니다.
  • server
    • 헥사고날 아키텍처의 adapter - in 영역에 해당
    • controller를 포함하고 있으며, 모든 클래스는 internal 접근제한자로 설정되어 있습니다.
  • util
    • core, server, infrastructure 모듈에서 공통적으로 사용할 유틸이 들어있습니다.

1.2. Tech Stacks

  • JDK 17
  • Kotlin 1.6.21
  • Build Tools
    • Gradle
    • Kotlin DSL
  • Spring MVC
    • Tomcat
  • Spring Boot 2
  • Spring Data JPA
  • MariaDB 10.8.3
  • OpenAPI Specification
    • Swagger v3
      • springdoc-openapi ui 1.6.13

1.3. demo-app

demo 웹 애플리케이션의 실행 진입점은 server - demo-app 모듈의 DemoAppApplication 입니다.

DemoAppApplication



demo-app은 아래와 같이 :util:common-util, :core:demo-core, :infrastructure:datastore-mariadb 모듈을 포함합니다.

build.gradle.kts


1.4. demo-all-in-one-app

demo-app을 하나의 모듈로 만든 웹 애플리케이션

adapter + core + domain 을 하나의 프로젝트 내에 구성했습니다.

스크린샷 2022-12-02 오후 2 08 10


2. demo-reactive-app

2.1. 프로젝트 구성

demo-reactive-app 프로젝트도는 멀티 모듈로 구성되어있습니다.

2-1

  • core
    • 헥사고날 아키텍처의 application core 영역에 해당
    • 프로젝트의 핵심적인 비즈니스 로직이 들어있습니다
    • domain, port를 포함하고 있으며, 모든 클래스는 public 접근제한자로 설정되어 있습니다.
  • infrastructure
    • 헥사고날 아키텍처의 adapter - out 영역에 해당
    • datasource에 관련된 모듈이 들어갑니다.
    • persistence adapter, JpaRepository, ORM Entity 가 포함되어있습니다.
  • server
    • 헥사고날 아키텍처의 adapter - in 영역에 해당
    • controller를 포함하고 있으며, 모든 클래스는 internal 접근제한자로 설정되어 있습니다.
  • util
    • core, server, infrastructure 모듈에서 공통적으로 사용할 유틸이 들어있습니다.

2.2. Tech Stacks

  • JDK 17
  • Kotlin 1.6.21
  • Build Tools
    • Gradle
    • Kotlin DSL
  • Spring WebFlux
    • Netty
    • Coroutines
  • Spring Boot 2
  • Spring Data MongoDB Reactive
  • MongoDB 6.0.4
  • OpenAPI Specification
    • Swagger v3
      • springdoc-openapi-kotlin 1.6.14
      • springdoc-openapi-webflux-ui 1.6.14

2.3. demo-reactive-app

demo 웹 애플리케이션의 실행 진입점은 server - demo-reactive-app 모듈의 DemoReactiveAppApplication 입니다.

demo-reactive-app은 아래와 같이 :util:common-util, :core:demo-reactivecore, :infrastructure:datastore-mongodb-reactive 모듈을 포함합니다.

demo-reactive-app