目录
1、项目model
2、微服务项目分层
3、rest目录调整
4、core目录调整
5、client 目录调整
背景:公司以前没有规范导致每个项目结构都不同,项目结构混乱,维护非常困难。经过多次设计讨论,最终确定以下结构规范。
1、项目model
xxx-client---feign
xxx-core---核心业务逻辑
xxx-rest---controller
2、微服务项目分层
![](https://img-blog.csdnimg.cn/c76e2cb9758f405b94dae7da5526456e.png)
流转过程: Controller=>Service=>Manager=>Repository/Client/Support
service与manager也包含convert包
repository-db查询
目前包括:es、mongo、mysql
![](https://img-blog.csdnimg.cn/05429f4cfb024c1db5cedc77b1d68705.png)
support-三方组件及外部接口调用封装
目前包括:redis、mq、对client的封装
![](https://img-blog.csdnimg.cn/7059551fae954b22a6ad9f4217b73aae.png)
3、rest目录调整
├─annotation │ └─aspect ├─config │ └─handler ├─controller ├─model │ ├─convert │ ├─dto │ └─vo └─util |
4、core目录调整
├─annotation │ └─aspect ├─config │ └─handler ├─context ├─common │ ├─constant---多处使用需要抽出,单类枚举太多也需要抽出 │ └─exception ├─data │ ├─domain │ └─repository ├─model │ └─convert ├─manager ├─service ├─schedule ├─support │ ├─redis │ └─mq └─util |
5、client 目录调整
├─config │ └─deserialize ├─cloud │ └─feign │ └─fallback └─model └─convert |
配置按就近原则,比如:因为jap配置只有data包使用,所以jap的配置就直接丢到data包里。