Skip to content

一个基于 spring-boot 的六边形架构风格 Demo

Notifications You must be signed in to change notification settings

threeq/hexagon-boot

Repository files navigation

hexagon-boot 六边形架构风格 demo 项目

                    /----------\
                  /              \
                /                  \
              /                      \
            /         /-----\          \
           |         /       \          |  
    User --+-Adapter/ 应用服务 \  Adapter+-- DB
           |        |    ^    |         |
           |        |    |    |         |
           |        \ 领域模型 / Adapter-+-- Document
            \        \       /         /
              \       \-----/        /
                \                  /
                  \              /
                    \----------/

  • libs 项目自身所需要的依赖的公共库,比如工具类
  • core 包含领域模型 和 应用服务器,实现业务逻辑。core 自己不提供独立运行能力
  • adapterendpoint 属于适配 端口,这里区别是在于 endpoint 可以独立运行,adapter 不能独立运行。包含 Facade、Translator、Adapter

运行 demo

  1. 启动依赖服务器 mysql
docker-compose up -d
  1. 启动 adapter-rest 适配 端口
./gradlew bootRun -p hexagon-boot-endpoint-rest
  1. 测试服务
# post 提交数据
curl -XPOST -H "Content-type: application/json" http://127.0.0.1:8080/v1/report/error \
-d'{ "appType":"1111111111", "pageUrl":"222222" }'


# 通过 get 请求查看数据提交是否成功
curl -XGET http://127.0.0.1:8080/v1/report/error 

About

一个基于 spring-boot 的六边形架构风格 Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published