当前位置:网站首页>领域驱动下cloud项目中单个服务的示例
领域驱动下cloud项目中单个服务的示例
2022-06-30 07:56:00 【匿称s】
Domain Driven Design - 领域驱动设计【重点在于设计】
每个人和每个项目对于DDD的理解和实施都是有不同的看法,这里所指出的架构方案也只是其中的一种方式而已。
核心的想法就是让代码高内聚,低耦合,让项目的重点放在领域逻辑,而并不是在表现输出上。
这里的四层架构也是DDD所倡导的,核心理念这里就不多说了...外面说理念的文章太多了..这里就给大家看下在我搭建的微服务架构下DDD的践行方式
Demo-application 定义软件要完成的任务,这一层很轻,没有业务的标识,只是为领域层起到协调任务【服务】的作用
|- com.ddd.demo
|- service 定义项目中可提供的服务
XXXservice
|- aop 定义切面要处理的业务:处理日志记录等
Demo-domain 领域层,这一层是业务的核心,虽然细节都是由基础设施层完成,但是这一层数聚合基础设施完成业务的表达层
|- com.ddd.demo
|- XXX 包为application中定义的服务名称,具体实现类在此包下实现
|- impl 具体服务的实习类,实现 XXXservice的接口
|- repo 定义需要从基础设施层的仓库接口
|- vo 定义服务内的服务实现类的返回值,也是基础设施层仓库实现类返回数据标准
Demo-infrastructure 基础设施层,像其他层提供表达能力,内部与数据进行交互,包括不仅限于数据库。
|- entity 实体类,作为数据查询的映射
|- mapper 数据存储对象,相当于dao层
|- repo 具体仓库的实现类,实现domain中的repo接口
|- utils 工具包
|- config 配置类
Demo-interfaces 表示层,用于接收系统外部的请求和其他服务的调用
|- dto 数据传输对象,可在此做数据校验
|- facade 表示层,这里用于做接收请求也就是控制器
|- feign 跨服务的接口调用定义的api
边栏推荐
- Armv8 (coretex-a53) debugging based on openocd and ft2232h
- Conversion between basic data types in go data types
- Final review -php learning notes 7-php and web page interaction
- Simple application of generating function -- integer splitting 2
- C. Fishingprince Plays With Array
- 【花雕体验】13 搭建ESP32C3之PlatformIO IDE开发环境
- 深度学习——使用词嵌入and词嵌入特征
- Fishingprince Plays with Array
- CRM&PM如何帮助企业创造最优销售绩效
- Deep learning - networks in networks and 1x1 convolution
猜你喜欢
Examen final - notes d'apprentissage PHP 3 - Déclaration de contrôle du processus PHP
安科瑞高等学校校园建筑节能监管系统建设
Halcon12+vs2013 C # configuration
Deep learning -- feature point detection and target detection
January 23, 2022 [reading notes] - bioinformatics and functional genomics (Chapter 6: multiple sequence alignment)
全栈最全性能测试理论-总结
深度学习——词汇表征
Analysis of cross clock transmission in tinyriscv
Introduction notes to pytorch deep learning (10) neural network convolution layer
期末复习-PHP学习笔记1
随机推荐
Deep learning - embedding matrix and learning word embedding andword2vec
24C02
Final review -php learning notes 4-php custom functions
期末复习-PHP学习笔记4-PHP自定义函数
Arm debug interface (adiv5) analysis (I) introduction and implementation [continuous update]
JS代码案例
min_ max_ Gray operator understanding
2021-10-27 [WGS] pacbio third generation methylation modification process
mysql无法连接内网的数据库
Why don't you know what to do after graduation from university?
【笔记】Polygon mesh processing 学习笔记(10)
深度学习——GRU单元
Tencent and Fudan University "2021-2022 yuan universe report" with 102 yuan universe collections
奇迹MU服务器租用选择 真实好用 稳定不卡 还能防入侵
Fishingprince Plays with Array
Spring Festival inventory of Internet giants in 2022
C. Fishingprince Plays With Array
C. Fishingprince Plays With Array
期末复习-PHP学习笔记1
Self study notes -- use of 74h573