[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4041":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":16,"starSnapshotCount":16,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},4041,"COLA","alibaba\u002FCOLA","alibaba","🥤 COLA: Clean Object-oriented & Layered Architecture","",null,"Java",12966,3237,342,75,0,6,31,3,76.1,"GNU Lesser General Public License v2.1",false,"master",[25,26,27],"architecture","clean","cola","2026-06-12 04:00:20","# 🥤 COLA v5\n\n[![Fast CI](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Falibaba\u002Fcola\u002Fci.yaml?branch=master&logo=github&logoColor=white&label=fast%20ci)](https:\u002F\u002Fgithub.com\u002Falibaba\u002Fcola\u002Factions\u002Fworkflows\u002Fci.yaml)\n[![Multiply Java versions CI](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Falibaba\u002Fcola\u002Fci_by_multiply_java_versions.yaml?branch=master&logo=github&logoColor=white&label=strong%20ci)](https:\u002F\u002Fgithub.com\u002Falibaba\u002Fcola\u002Factions\u002Fworkflows\u002Fci_by_multiply_java_versions.yaml)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-LGPL--2.1-4EB1BA.svg?color=4D7A97&logo=apache)](LICENSE)\n[![Java support](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FJava-17+-339933?logo=OpenJDK&logoColor=white)](https:\u002F\u002Fopenjdk.java.net\u002F)\n[![Maven Central](https:\u002F\u002Fimg.shields.io\u002Fmaven-central\u002Fv\u002Fcom.alibaba.cola\u002Fcola-component-dto.svg?logo=apache-maven&label=maven%20central)](https:\u002F\u002Fcentral.sonatype.com\u002Fnamespace\u002Fcom.alibaba.cola)\n[![GitHub Releases](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Falibaba\u002FCOLA.svg)](https:\u002F\u002Fgithub.com\u002Falibaba\u002FCOLA\u002Freleases)\n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Falibaba\u002FCOLA?style=flat)](https:\u002F\u002Fgithub.com\u002Falibaba\u002FCOLA\u002Fstargazers)\n[![GitHub Forks](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fforks\u002Falibaba\u002FCOLA?style=flat)](https:\u002F\u002Fgithub.com\u002Falibaba\u002FCOLA\u002Ffork)\n[![user repos](https:\u002F\u002Fbadgen.net\u002Fgithub\u002Fdependents-repo\u002Falibaba\u002FCOLA?label=user%20repos)](https:\u002F\u002Fgithub.com\u002Falibaba\u002FCOLA\u002Fnetwork\u002Fdependents)\n[![GitHub issues](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fissues\u002Falibaba\u002FCOLA.svg)](https:\u002F\u002Fgithub.com\u002Falibaba\u002FCOLA\u002Fissues)\n[![GitHub Contributors](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fcontributors\u002Falibaba\u002FCOLA)](https:\u002F\u002Fgithub.com\u002Falibaba\u002FCOLA\u002Fgraphs\u002Fcontributors)\n[![gitpod: Ready to Code](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGitpod-ready%20to%20code-339933?label=gitpod&logo=gitpod&logoColor=white)](https:\u002F\u002Fgitpod.io\u002F#https:\u002F\u002Fgithub.com\u002Falibaba\u002FCOLA)\n\n\u003Cstrong>COLA 是 Clean Object-Oriented and Layered Architecture的缩写，代表“整洁面向对象分层架构”。\n目前COLA已经发展到[COLA v5](#版本迭代)。\u003C\u002Fstrong>\n\n> - 想了解更多COLA信息，请关注微信公众号：  \n> \u003Ca href=\"#dummy\">\u003Cimg src=\"https:\u002F\u002Fimg-blog.csdnimg.cn\u002F2020110314110321.png\" width=\"25%\" alt=\"qrcode\" \u002F>\u003C\u002Fa>\n> - 想了解更多COLA背后的故事，请支持我的新书[《程序员的底层思维》](https:\u002F\u002Fitem.jd.com\u002F13652002.html)\n\nCOLA分为两个部分，COLA架构和COLA组件。\n\n# 一、COLA架构\n\n## COLA 概述\n\n**架构**的**意义** 就是 要素结构：\n\n- 要素 是 组成架构的重要元素；\n- 结构 是 要素之间的关系。\n\n而 **应用架构**的**意义** 就在于\n\n- 定义一套良好的结构；\n- 治理应用复杂度，降低系统熵值；\n- 从随心所欲的混乱状态，走向井井有条的有序状态。\n\n\u003Ca href=\"#dummy\">\u003Cimg src=\"https:\u002F\u002Fimg-blog.csdnimg.cn\u002Fe27c22d706084ead900c8838326135f3.png\" alt=\"arch why\" \u002F>\u003C\u002Fa>\n\nCOLA架构就是为此而生，其核心职责就是定义良好的应用结构，提供最佳应用架构的最佳实践。通过不断探索，我们发现良好的分层结构，良好的包结构定义，可以帮助我们治理混乱不堪的业务应用系统。\n\n\u003Ca href=\"#dummy\">\u003Cimg src=\"https:\u002F\u002Fimg-blog.csdnimg.cn\u002F2020120918285068.png\" alt=\"cure\" \u002F>\u003C\u002Fa>\n\n经过多次迭代，我们定义出了相对稳定、可靠的应用架构：\n\n\u003Ca href=\"#dummy\">\u003Cimg src=\"https:\u002F\u002Fimg-blog.csdnimg.cn\u002F6549230c6723448fb3ab51ca74829e80.png\" alt=\"cola arch\" \u002F>\u003C\u002Fa>\n\n## COLA Archetypes\n\n好的应用架构，都遵循一些共同模式，不管是六边形架构、洋葱圈架构、整洁架构、还是COLA架构，**都提倡以业务为核心，解耦外部依赖，分离业务复杂度和技术复杂度等**。\n\nCOLA架构区别于这些架构的地方，在于除了思想之外，我们还提供了可落地的工具和实践指导。\n\n为了能够快速创建满足COLA架构的应用，我们提供了两个`archetype`，位于[`cola-archetypes`目录](cola-archetypes)下：\n\n1. `cola-archetype-service`：用来创建纯后端服务的`archetype`。\n2. `cola-archetype-web`：用来创建`adapter`和后端服务一体的`web`应用`archetype`。\n\n# 二、COLA组件\n\n此外，我们还提供了一些非常有用的通用组件，这些组件可以帮助我们提升研发效率。\n\n这些功能组件被收拢在[`cola-components`目录](cola-components)下面。到目前为止，我们已经沉淀了以下组件：\n\n组件名称 | 功能 | 依赖\n------ | ---- | ----\n`cola-component-dto` | 定义了`DTO`格式，包括分页 |无\n`cola-component-exception` | 定义了异常格式，\u003Cbr>主要有`BizException`和`SysException` |无\n`cola-component-statemachine` | 状态机组件 | 无\n`cola-component-domain-starter` | `Spring`托管的领域实体组件 | 无\n`cola-component-catchlog-starter` | 异常处理和日志组件 | `exception`、`dto`组件\n`cola-component-extension-starter` | 扩展点组件 | 无\n`cola-component-test-container` | 测试容器组件 | 无\n\n# 三、如何使用COLA\n\n## 1. 创建应用\n\n执行以下命令：\n\n```bash\nmvn archetype:generate \\\n    -DgroupId=com.alibaba.cola.demo.web \\\n    -DartifactId=demo-web \\\n    -Dversion=1.0.0-SNAPSHOT \\\n    -Dpackage=com.alibaba.demo \\\n    -DarchetypeArtifactId=cola-framework-archetype-web \\\n    -DarchetypeGroupId=com.alibaba.cola \\\n    -DarchetypeVersion=5.0.0\n```\n\n命令执行成功的话，会看到如下的应用代码结构：\n\n\u003Ca href=\"#dummy\">\u003Cimg src=\"https:\u002F\u002Fimg-blog.csdnimg.cn\u002F20201209192258840.png\" alt=\"demo struture\" \u002F>\u003C\u002Fa>\n\n## 2. 运行应用\n\n- 在`项目`目录下运行`mvn install`（如果不想运行测试，可以加上`-DskipTests`参数）。\n- 进入`start`目录，执行`mvn spring-boot:run`。  \n  运行成功的话，可以看到`SpringBoot`启动成功的界面。\n- 生成的应用中，已经实现了一个简单的`Rest`请求，可以在浏览器中输入 http:\u002F\u002Flocalhost:8080\u002Fhelloworld 进行测试。\n\n如果要生成不是`web`工程而是`service`工程也类似，执行的是下面的命令：\n\n```bash\nmvn archetype:generate \\\n    -DgroupId=com.alibaba.cola.demo.service \\\n    -DartifactId=demo-service \\\n    -Dversion=1.0.0-SNAPSHOT \\\n    -Dpackage=com.alibaba.demo \\\n    -DarchetypeArtifactId=cola-framework-archetype-service \\\n    -DarchetypeGroupId=com.alibaba.cola \\\n    -DarchetypeVersion=5.0.0\n```\n\n# 版本迭代\n\n## 5.0.0 版本\n1. 支持jdk17和SpringBoot 3.x\n2. 增加cola-archetype-light，支持新的基于package轻量级分层架构\n3. 增加cola-component-unittest组件，支持[新的单元测试](https:\u002F\u002Fblog.csdn.net\u002Fsignificantfrank\u002Farticle\u002Fdetails\u002F137495244)\n4. 增强cola-component-test-container组件，支持Junit5的Extension\n\n\n## 4.0.0 版本\n\nhttps:\u002F\u002Fblog.csdn.net\u002Fsignificantfrank\u002Farticle\u002Fdetails\u002F110934799\n\n## 3.1.0 版本\n\nhttps:\u002F\u002Fblog.csdn.net\u002Fsignificantfrank\u002Farticle\u002Fdetails\u002F109529311\n\n1. 进一步简化了`cola-core`，只保留了扩展能力。\n2. 将`exception`从`cola-core`移入到`cola-common`。\n3. 对`archetype`中的分包逻辑进行重构，改成按照`domain`做划分。\n4. 将`cola-archetype-web`中的`controller`改名为`adapter`，为了呼应六边形架构的命名。\n\n## 3.0.0 版本\n\nhttps:\u002F\u002Fblog.csdn.net\u002Fsignificantfrank\u002Farticle\u002Fdetails\u002F106976804\n\n## 2.0.0 版本\n\nhttps:\u002F\u002Fblog.csdn.net\u002Fsignificantfrank\u002Farticle\u002Fdetails\u002F100074716\n\n## 1.0.0 版本\n\nhttps:\u002F\u002Fblog.csdn.net\u002Fsignificantfrank\u002Farticle\u002Fdetails\u002F85785565\n\n\n","COLA 是一个旨在提供整洁面向对象分层架构的 Java 项目。它通过定义良好的分层结构和包结构，帮助开发者治理应用复杂度，降低系统熵值，从而实现从混乱到有序的转变。COLA 的核心功能包括清晰的应用架构定义、最佳实践指导以及一系列可落地的工具支持。技术特点上，COLA 支持多种 Java 版本，并且提供了 Maven 中央仓库支持，便于集成和使用。适用于需要构建大型、复杂但结构清晰的企业级应用开发场景，特别是那些希望遵循以业务为核心，解耦外部依赖原则的项目。",2,"2026-06-11 02:58:04","top_language"]