{"repo":"smart-cloud/smart-cloud-examples","free":true,"listed":false,"github":"https://github.com/smart-cloud/smart-cloud-examples","clone":"git clone https://github.com/smart-cloud/smart-cloud-examples.git","description":"基于 smart-cloud 的企业级微服务示例项目","language":"Java","stars":33,"topics":["springcloud","springboot","microservice","shardingsphere","rabbitmq","redis","openfeign","dynamic-datasource","integration-test","smoke-test"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"Smart Cloud Examples 基于 smart-cloud 的企业级微服务示例项目 项目简介 • 核心特性 • 技术栈 • 工程结构 • 接口安全 • 快速开始 • 错误码 • FAQ --- 一、项目简介 此项目为基于 smart-cloud 的微服务示例项目，面向 企业级分布式系统 的教学与落地参考。 自动化构建见 ci 二、核心特性 特性 说明 ------ ------ 接口安全体系 动态 API Meta 注册（网关主动拉取），多维度鉴权（token / 签名 / 时间戳 / 黑白名单） 数据安全 请求与响应全链路 AES + RSA 加解密、 smart- 请求头签名验签机制 模块化架构 分 support （网关 / 注册中心）、 basic （用户 / 权限）、 mall （订单 / 商品）、 rpc （服务调用）、 merge （单体合并）五大功能域 服务合并部署 支持通过 merge-module 将多个微服务合并为单体应用部署，降低开发与运维成本 分布式事务 集成 Seata 实现分布式事务管理 流量治理 集成 Sentinel 实现限流、熔断等流量防护 三、技术栈 分类 技术 ------ ------ 开发语言 Java 8+ 微服务框架 smart-cloud 1.0.7-SNAPSHOT 注册中心 Nacos 网关 Spring Cloud Gateway 分布式事务 Seata 1.4.0 消息中间件 RabbitMQ 缓存 Redis 数据库 MySQL 安全 RSA + AES 加解密、Jasypt 配置加密 构建工具 Maven 四、工程结构 服务说明 工程模块图 架构图 五、接口安全 安全流程 1. 通过自定义注解，监听服务启动完毕后通知 Gateway；Gateway 根据服务名去注册中心获取服务的 IP、Port，然后通过 HTTP 主动拉取服务的 API Meta 信息（是否签名、是否加密、是否需要鉴权等），存至 Redis。 注意： 此处为了接口安全考虑，没有直接将 API Meta 信息由服务主动上报给 Gateway。 2. 后台管理系统在配置权限时，会通过 RPC 接口刷新网关服务存储的权限信息。 3. 用户登录成功后，会将所拥有的权限信息通过 RPC 上传给网关。 4. 用户访问接口通过网关时，会与缓存在 Redis 里的信息做加解密、鉴权等处理。 接口数据加解密、签名流程 1. 约定 只支持 application/json 格式的数据加解密、签名！ 2. 响应对象 Response 组成 3. 签名与加密 密钥传递流程 请求参数 返回结果 对返回数据处理步骤：AES 加密 → Base64 处理 → RSA 签名 代码实现 - 后端接收请求：DataSecurityServerHttpRequestDecorator.java - 后端返回信息：DataSecurityServerHttpResponseDecorator.java 六、快速开始 环境依赖 中间件 说明 -------- ------ Redis 缓存 MySQL 数据库 RabbitMQ 消息队列 Nacos 注册中心 / 配置中心 Seata 分布式事务 搭建步骤 1. 安装并启动中间件 2. 初始化数据库 执行 /docs/sql 目录下的 SQL 脚本： 3. Nacos 配置 在 Nacos 中导入相关配置文件（参考 docs/nacos 目录）： 4. Seata 配置 - Server SQL ","default_branch":null,"files":null,"tree":[],"storefront":"/r/smart-cloud","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/smart-cloud/smart-cloud-examples/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}