DEV Community

小猫先生
小猫先生

Posted on

2

模块设计(Spring Cloud)

引自: http://skaka.me/blog/2016/08/10/springcloud3/

一个完整系统的各模块关系示例。每个服务都应当是一个独立的项目, 彼此之间只是通过 pom 引用。

普通目录

  • docs: 存放文档资料, 例如数据库脚本, astah 文件 (UML 工具) 等.
  • logs: 运行日志存放目录.

公共模块

  • apiutils: api 模块公共父模块.
  • common: 服务模块公共父模块, 存放微服务共同依赖的逻辑, 例如事件处理, 定时任务等.
  • utils: 工具类模块.

基础服务模块

  • eureka: eureka 服务. 提供服务注册与服务发现
  • config: config 服务. 提供配置管理服务
  • turbine: hystrix 服务监控

服务模块

  • account: 账户服务.
  • coupon: 优惠券服务.
  • order: 订单服务.
  • product: 产品服务.
  • user: 用户服务.

其他模块

  • integration-test: 集成测试模块.

模块内部结构

  • api: api 接口模块. 其他依赖 user 服务的服务会依赖这个模块.
  • core: user 服务实现模块.
  • api 和 core 模块内容都是标准的 maven 项目结构, 其中 core 模块主要有这么一些子目录:
    • context: 存放 Spring Boot 启动类.
    • dao: DAO 层.
    • domain: Model 层. service: Service 层.
    • web: 存放 Spring MVC Controller.

模块关系

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more