{"id":19391211,"url":"https://github.com/micyo202/lion","last_synced_at":"2025-04-05T10:09:26.342Z","repository":{"id":47709849,"uuid":"133048110","full_name":"micyo202/lion","owner":"micyo202","description":"使用Gradle构建，基于Java 8/11/13、SpringBoot 2.2.6.RELEASE、SpringCloud Hoxton.SR2、Spring Cloud Alibaba 2.2.0.RELEASE、MyBatis Plus 3.3.1等核心技术体系实现的一套支持云原生的分布式微服务架构，提供OAuth2/JWT权限认证、分布式事务、灰度、限流、熔断降级、分布式锁、链路追踪、MQ等功能，支持Docker容器化部署、镜像交付、K8S容器编排","archived":false,"fork":false,"pushed_at":"2021-11-26T01:57:52.000Z","size":50204,"stargazers_count":460,"open_issues_count":5,"forks_count":208,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-03-29T09:11:48.355Z","etag":null,"topics":["alibabacloud","docker","feign","gradle","jwt","kubernetes","nacos","oauth2","ribbon","seata","sentinel","skywalking","springboot","springcloud","zipkin"],"latest_commit_sha":null,"homepage":"https://www.micyo202.cn","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micyo202.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-11T14:10:08.000Z","updated_at":"2025-03-16T11:06:39.000Z","dependencies_parsed_at":"2022-08-28T09:10:20.769Z","dependency_job_id":null,"html_url":"https://github.com/micyo202/lion","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Flion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Flion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Flion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micyo202%2Flion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micyo202","download_url":"https://codeload.github.com/micyo202/lion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318745,"owners_count":20919484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alibabacloud","docker","feign","gradle","jwt","kubernetes","nacos","oauth2","ribbon","seata","sentinel","skywalking","springboot","springcloud","zipkin"],"created_at":"2024-11-10T10:25:41.641Z","updated_at":"2025-04-05T10:09:26.322Z","avatar_url":"https://github.com/micyo202.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Lion\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-16e4831f4de664c7.png[align=\"center\"]\n\n//image:https://github.com/micyo202/lion/workflows/Java%20CI%20with%20Gradle/badge.svg[\"Lion CI with Gradle\", link=\"https://github.com/micyo202/lion/runs/775396303?check_suite_focus=true\"]\nimage:https://travis-ci.org/micyo202/lion.svg?branch=master[\"Build Status\", link=\"https://travis-ci.org/micyo202/lion\"]\nimage:https://badges.gitter.im/micyo202/lion.svg[\"Gitter\", link=\"https://gitter.im/micyo202/lion?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\"]\nimage:https://app.codacy.com/project/badge/Grade/bcb58d648e0e4e15a90fade3f96278ed[\"Codacy Badge\", link=\"https://www.codacy.com/gh/micyo202/lion/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=micyo202/lion\u0026amp;utm_campaign=Badge_Grade\"]\nimage:https://codecov.io/gh/micyo202/lion/branch/master/graph/badge.svg[\"Codecov\", link=\"https://codecov.io/gh/micyo202/lion\"]\nimage:https://img.shields.io/badge/Version-2.0.8.GA-DAA520.svg[\"Version\", link=\"https://github.com/micyo202/lion/releases\"]\nimage:https://img.shields.io/badge/Java-8/11/13-DA001C.svg[\"Java\", link=\"https://www.oracle.com/technetwork/java/javase/downloads/index.html\"]\nimage:https://img.shields.io/badge/Gradle-6.6-01BC7E.svg[\"Gradle\", link=\"https://gradle.org\"]\nimage:https://img.shields.io/badge/SpringBoot-2.2.6.RELEASE-4682B4.svg[\"Spring Boot\", link=\"https://spring.io/projects/spring-boot\"]\nimage:https://img.shields.io/badge/SpringCloud-Hoxton.SR2-5DBF3D.svg[\"Spring Cloud\", link=\"https://spring.io/projects/spring-cloud\"]\nimage:https://img.shields.io/badge/Apache\u0026nbsp;License-2.0-lightgrey.svg[\"Apache License 2.0\", link=\"https://github.com/micyo202/lion/blob/master/LICENSE\"]\nimage:https://img.shields.io/github/stars/micyo202/lion.svg?style=social\u0026label=Stars[\"GitHub Stars\", link=\"https://github.com/micyo202/lion\"]\nimage:https://img.shields.io/github/forks/micyo202/lion.svg?style=social\u0026label=Fork[\"GitHub Fork\", link=\"https://github.com/micyo202/lion\"]\n\n---\n\n*lion* 是基于 *Spring Cloud* 体系实现的一套支持云原生的分布式微服务架构，为了让中小型公司解决当下技术瓶颈，快速将现有应用服务架构拆分改造为分布式微服务架构，进入 *All-in-Cloud* 时代，只需在本架构上进行相关业务开发即可，大大减少了分布式微服务架构的门槛，使架构师及开发人员不必过多的关注架构本身，只需专注于业务开发\n\n项目采用 *Gradle* 构建，基于 *Java 8/11/13、SpringBoot 2.2.6.RELEASE、SpringCloud Hoxton.SR2、Spring Cloud Alibaba 2.2.0.RELEASE、MyBatis Plus 3.3.1* 等核心技术体系实现的一套支持云原生的分布式微服务架构，提供 *OAuth2/JWT* 权限认证、分布式事务、灰度、限流、熔断降级、分布式锁、链路追踪、MQ等功能，支持 *Docker* 容器化部署、镜像交付、K8S容器编排\n\n使用 *Nacos* 作为服务注册/发现、配置中心\n\n使用 *Sentinel* 来查看近实时的接口运行状态和调用频率，并用作服务限流、熔断降级等处理，避免了分布式服务之间调用的“雪崩”效应\n\n使用 *Seata* 作为分布式事务管理，采用AT事务模式自动完成两阶段提交/回滚\n\n使用 *Spring Boot Admin* 来监控各个独立 *Service* 的运行状态\n\n使用 *Spring Cloud Gateway* 作为路由网关服务\n\n使用 *Zipkin / SkyWalking* 进行查看完整链路追踪信息等\n\n使用 *Feign*, 做到HTTP请求远程服务时能与调用本地方法一样的编码体验，开发者完全感知不到这是远程方法，更感知不到这是个HTTP请求\n\n项目后期会不断更新与时俱进，敬请期待...\n\n_项目镜像已经推送至 https://hub.docker.com[Docker Hub]，请前往 https://hub.docker.com/u/micyo202 查看/拉取_\n\n== 项目架构图\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-c10225e5f151d9c0.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n== 数据库表关系图\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-75795f0b6dd09d59.png?imageMogr2/auto-orient/strip|imageView2/2/w/1108[align=\"center\"]\n\n== 分支说明\n\n- https://github.com/micyo202/lion[master分支]，支持Java 8/11/13重构升级优化后的最新版（推荐）\n- https://github.com/micyo202/lion/tree/release1.x[release1.x分支]，基于Java 8、SpringBoot 2.1.2.RELEASE、SpringCloud Greenwich.RELEASE、Spring Cloud Alibaba 2.1.0.RELEASE体系实现，支持Java、Scala混编，的最终版\n- https://github.com/micyo202/lion/tree/eureka[eureka分支]，使用 Eureka 作为服务注册发现中心（Eureka官宣2.x版本不再开源，项目使用Nacos）\n- https://github.com/micyo202/lion/tree/hystrix[hystrix分支]，使用 Hystrix 做为服务断路器（Hystix官宣停止更新，项目使用Sentinel）\n- https://github.com/micyo202/lion/tree/zuul[zuul分支]，使用 Zuul 做为路由网关（由于Zuul 2.x的不断跳票，SpringCloud后续没有整合Zuul 2.x的计划，项目使用Spring Cloud Gateway）\n\n== 一、项目开发环境\u0026工具\n\n* MacOS / Windows\n* CentOS\n* Java 8/11/13\n* IntelliJ IDEA / Eclipse\n\n== 二、相关软件\n\n_说明： `√` 表示必要服务， `x` 表示非必要服务_\n\n|===\n| 名称 | 链接 | 必须\n\n| MySql 8.0.19\n| https://www.mysql.com\n^| √\n\n| Redis 5.0.7\n| https://redis.io\n^| √\n\n| RabbitMQ 3.8.2\n| https://www.rabbitmq.com\n^| √\n\n| Nacos 1.1.4\n| https://nacos.io\n^| √\n\n| Sentinel 1.7.1\n| https://sentinelguard.io\n^| √\n\n| Seata 1.0.0\n| https://seata.io\n^| √\n\n| Zipkin 2.20\n| https://zipkin.io\n^| x\n\n| SkyWalking 6.6.0\n| http://skywalking.apache.org\n^| x\n\n| ElasticSearch 7.6.1\n| https://www.elastic.co/cn\n^| x\n|===\n\n_注：在启动项目前，请先确保启动： https://www.mysql.com[MySql 8.0.19]、 https://redis.io[Redis 5.0.7]、 https://www.rabbitmq.com[RabbitMQ 3.8.2]、 https://nacos.io[Nacos 1.1.4]、 https://github.com/alibaba/sentinel[Sentinel 1.7.1]、 https://seata.io[Seata 1.0.0]这 [big]#6# 个必备服务（#需把 *Sentinel* 默认端口 *8080* 改为 *8858*#），启动方式可参考 https://github.com/micyo202/lion/tree/master/docs[docs]文档_\n\n=== 三、组件说明\n\n* 服务注册/发现、配置中心：Nacos\n* 服务监控：Spring Boot Admin\n* 消息队列：AMQP -\u003e RabbitMQ\n* 负载均衡服务调用：Feign / Ribbon\n* 限流、熔断降级：Sentinel\n* 分布式事务：Seata\n* 路由网关：Spring Cloud Gateway\n* 链路追踪：Spring Cloud Sletuh -\u003e Zipkin / SkyWalking\n* 权限认证：Spring Security -\u003e OAuth2 / JWT\n* 分布式锁：Redisson\n* ORM框架：MyBatis（MyBatis-Plus）\n* 数据源监控：Druid\n* RESTful APIs文档：Knife4j\n\n== 四、项目结构\n\n[source,lua]\n----\nlion -- 根目录\n├── lion-admin -- 服务监控\n├── lion-gateway -- 网关服务\n├── lion-common -- 通用工具类\n├── lion-auth -- 安全认证服务\n├── lion-demo -- 示例模块\n|    ├── lion-demo-provider -- 服务提供者\n|    ├── lion-demo-consumer -- 服务消费者\n----\n\n== 五、项目部署\n\n. 下载项目 `git clone --depth 1 https://github.com/micyo202/lion.git`\n\n. 进入项目根目录执行 `./gradlew -x test clean` 命令，使用 *Gradle* 初始化项目\n\n. 初始化完毕后导入到 *IDE* 开发工具中（建议使用 https://www.jetbrains.com/idea?from=lion[IntelliJ IDEA] 作为开发工具）\n\n. 按照文档中 [big]#[underline]##二、相关软件### 的内容，启动 [big]#6# 个必备服务，否则项目无法正常运行\n\n. 创建 [big]##3## 个数据库分别为 *lion、seata、zipkin* 并分别执行项目根目录下 *database* 中的 *https://github.com/micyo202/lion/blob/master/database/lion.sql[lion.sql]、 https://github.com/micyo202/lion/blob/master/database/seata.sql[seata.sql]、 https://github.com/micyo202/lion/blob/master/database/zipkin.sql[zipkin.sql]* 脚本，该脚本会创建项目所需的表（lion库中包含：用户表、角色表、菜单资源表等，seata库中包含：全局事务表、分支事务表、全局锁表，zipkin库中包含：链路追踪相关表）\n\n. 根据自己的服务器情况，修改 *resources* 下 *bootstrap.yml* 配置中的 *nacos* 服务地址，及 *application.yml* 配置中 *mysql、redis、rabbitmq、sentinel* 的服务地址跟用户名/密码\n\n. 将修改后的 *application.yml* 配置文件按应用名并分环境放入 *nacos* 配置管理中（#dev / test / prod#）\n\n. 完成以上步骤就可以正常启动部署服务了\n\n. 项目开发详细示例代码，可参考 *lion-demo* 示例模块\n\n. 测试方法使用 https://www.getpostman.com[postman] 导入项目根目录下 *json* 中的 https://github.com/micyo202/lion/raw/master/json/postman.json[postman.json] 脚本即可\n\n== 六、端口使用\n\n* Nacos（端口：8848）\n* Sentinel（端口：8858）\n* Seata（端口：8091）\n* Zipkin（端口：9411）\n* SkyWalking（端口：8900）\n\n* lion-admin（端口：8200）\n* lion-gateway（端口：8400）\n* lion-auth（端口：8888）\n* lion-demo\n** lion-demo-provider（端口：8601、8602、8603...）\n** lion-demo-consumer（端口：8701、8702、8703...）\n\n== 七、效果预览\n\n==== Nacos服务列表\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-cda39b98293daeda.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Nacos配置列表\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-292c5fab4c1ec93e.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Nacos服务详情\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-438e0e4f34a9a7fa.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Boot Admin应用监控\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-580075f6fe78e5da.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Boot Admin应用列表\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-907900742c6e853b.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Boot Admin应用详情\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-be406e234a641713.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Sentinel服务限流、熔断降级\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-dd4e2a23d6cc89c7.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Zipkin链路信息\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-5ce77cf7c8d665a2.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Zipkin链路追踪\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-c2abbd5245a492ab.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Zipkin拓扑图\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-2a25bd48123b0f21.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== SkyWalking监控面板\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-2eb4eb73e3e1bca6.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== SkyWalking链路追踪\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-77ae0216af3e361f.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== SkyWalking拓扑图\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-fe35d9af69f6cfa3.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-9150e47753478502.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Druid SQL监控\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-1424e4200d3c7d0a.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Druid URI监控\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-31a12c241db25772.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== Druid Spring监控\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-b5001ccb2c875735.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n==== RESTful APIs文档\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-aa89273f6d8f3fa7.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\nimage::https://upload-images.jianshu.io/upload_images/8015461-c397f97536fade0b.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200[align=\"center\"]\n\n== 八、开源协议\n\nhttps://github.com/micyo202/lion/blob/master/LICENSE[Apache Licence 2.0]（ http://www.apache.org/licenses/LICENSE-2.0.html[英文原文] ）Apache Licence 是著名的非盈利开源组织 Apache 采用的协议。该协议和 BSD 类似，同样鼓励代码共享和尊重原作者的著作权，同样允许代码修改，再发布（作为开源或商业软件）。需要满足的条件也和 BSD 类似：\n\n* 需要给代码的用户一份 Apache Licence\n* 如果你修改了代码，需要在被修改的文件中说明\n* 在延伸的代码中（修改和有源代码衍生的代码中）需要带有原来代码中的协议，商标，专利声明和其他原来作者规定需要包含的说明\n* 如果再发布的产品中包含一个 Notice 文件，则在 Notice 文件中需要带有 Apache Licence。你可以在 Notice 中增加自己的许可，但不可以表现为对 Apache Licence 构成更改\n\nApache Licence 也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售\n\n[TIP]\n====\n注：对未经过授权和不遵循 Apache Licence 2.0 开源协议二次开源或者商业化的我们将追究到底\n====","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicyo202%2Flion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicyo202%2Flion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicyo202%2Flion/lists"}