java架构设计-COLA

参考:https://github.com/alibaba/COLA

架构

要素:组成架构的重要元素
结构:要素直接的关系
意义:定义良好的结构,治理应用复杂度,降低系统熵值,改善混乱状态

java架构设计-COLA_第1张图片
创建COLA应用:

mvn archetype:generate \
    -DgroupId=com.alibaba.cola.demo.web \
    -DartifactId=demo-web \
    -Dversion=1.0.0-SNAPSHOT \
    -Dpackage=com.alibaba.demo \
    -DarchetypeArtifactId=cola-framework-archetype-web \
    -DarchetypeGroupId=com.alibaba.cola \
    -DarchetypeVersion=5.0.0

运行:

mvn install
mvn spring-boot:run

架构:

四层模型:

适配器层adaper:包括控制器Controller、定时器Scheduler、消息处理器Consumer。对应VO层
应用层application:应用的API、应用逻辑的入口执行类,对应DTO层
领域层domain:包括领域实体Entity、xxxDomainService、xxxGateway,对应Entity层
基础设施层infrastructure:xxxGatewayServiceImpl、xxxDO,对应DO层

划分:

  • 技术划分:
java:
  com.cola.blog:
    adapter:
    application:
    domain:
    infrastructure:
  BlogApplication.java
  • 领域划分:
tech.first.blog:
  adapter:
    article:
    comment:
  application:
    article:
    comment:
  domain:
    article:
    comment:
  infrastructure:
    article:
    comment:
BlogApplication.java

你可能感兴趣的:(java,开发语言)