刚果商城(CongoMall)项目教程
项目地址:https://gitcode.com/gh_mirrors/co/congomall
1. 项目的目录结构及介绍
刚果商城(CongoMall)是一个基于SpringCloud-Alibaba微服务架构设计的TOC商城系统,采用DDD领域驱动模型开发。项目的目录结构如下:
├── congomall-basic-data || -- # 基础数据服务
│ ├── congomall-basic-data-application
│ ├── congomall-basic-data-domain
│ ├── congomall-basic-data-infrastructure
│ ├── congomall-basic-data-interface
├── congomall-bff || -- # 商城 BFF 聚合层
│ ├── congomall-bff-biz
│ ├── congomall-bff-remote
│ ├── congomall-bff-web
├── congomall-cart || -- # 购物车服务
│ ├── congomall-cart-application
│ ├── congomall-cart-domain
│ ├── congomall-cart-infrastructure
│ ├── congomall-cart-interface
├── congomall-coupon || -- # 优惠券服务
├── congomall-customer-user || -- # C端用户服务
│ ├── congomall-customer-user-application
│ ├── congomall-customer-user-domain
│ ├── congomall-customer-user-infrastructure
│ ├── congomall-customer-user-interface
├── congomall-framework-all || -- # 基础组件
│ ├── congomall-base-spring-boot-starter
│ ├── congomall-cache-spring-boot-starter
│ ├── congomall-common-spring-boot-starter
│ ├── congomall-convention-spring-boot-starter
│ ├── congomall-database-spring-boot-starter
│ ├── congomall-ddd-framework-core
│ ├── congomall-designpattern-spring-boot-starter
│ ├── congomall-distributedid-spring-boot-starter
│ ├── congomall-flow-monitor-agent
│ ├── congomall-httputil-spring-boot-starter
│ ├── congomall-idempotent-spring-boot-starter
│ ├── congomall-log-spring-boot-starter
├── congomall-pay || -- # 支付服务
│ ├── congomall-pay-application
│ ├── congomall-pay-domain
│ ├── congomall-pay-infrastructure
│ ├── congomall-pay-interface
├── congomall-product || -- # 商品服务
│ ├── congomall-product-application
│ ├── congomall-product-domain
│ ├── congomall-product-infrastructure
│ ├── congomall-product-interface
│ ├── congomall-product-job
├── congomall-test-all || -- # 测试用例
│ ├── congomall-flow-monitor-agent-test
│ ├── congomall-h2-test
│ ├── congomall-oom-test
│ ├── congomall-smooth-sharding-test
│ ├── congomall-yaml-test
├── dev-support || -- # 开发工具包
2. 项目的启动文件介绍
每个服务模块通常包含一个启动类,用于启动Spring Boot应用程序。例如,在congomall-bff
模块中,启动类可能位于congomall-bff-web
包中,命名为BffApplication.java
。启动类通常包含@SpringBootApplication
注解,用于标识这是一个Spring Boot应用程序的主类。
package com.congomall.bff.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BffApplication {
public static void main(String[] args) {
SpringApplication.run(BffApplication.class, args);
}
}
3. 项目的配置文件介绍
每个服务模块通常包含一个或多个配置文件,用于配置应用程序的各种属性。常见的配置文件包括application.yml
或application.properties
。以下是一个示例配置文件的内容:
server:
port: 8009
spring:
application:
name: congomall-bff
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考