前言介绍
COLA既是框架,也是架构。创建COLA的主要目的是为应用架构提供一套简单的可以复制、可以理解、可以落地、可以控制复杂性的”指导和约束”。
源码地址: https://github.com/alibaba/COLA
快速启动示例项目craftsman
- 在本地新建craftsman的数据库,项目用的mysql driver是8.0的,所以可以使用mysql8
- 执行resource下的TableCreationDDL.sql,创建项目的表,共两张表
- 修改application.properties的配置文件的mysql用户名和密码
修改MetricDO类,新增两个属性(我的版本要加你看下你跑案例会不会报错)
private String creator="tangzihao";
private String modifier = "tangzihao";
需要在表user_profile中插数据
-
craftsman项目启动后测试
/metrics/ata的post方法测试
使用postman
方法 post
- 路径: localhost:8080/metrics/ata
请求体:
{
"ataMetricCO": {
"title":"母猪的产后护理",
"url":"https://www.google.com/search?q=%E7%A6%85%E4%B8%8E%E6%91%A9%E6%89%98%E8%BD%A6%E7%BB%B4%E4%BF%AE%E7%9A%84%E8%89%BA%E6%9C%AFpdf&oq=%E7%A6%85%E4%B8%8E%E6%91%A9%E6%89%98%E8%BD%A6&aqs=chrome.1.69i57j35i39j0l6.6603j0j4&sourceid=chrome&ie=UTF-8",
"thumbsUpCount":10,
"hitCount":1000,
"commentCount":100,
"favoriteCount":20,
"ownerId":"123456"
},
"operater": "tangzihao",
"needsOperator": true
}
metrics/ata get方法测试
方法: get
- 路径: localhost:8080/metrics/ata?ownerId=123456
模块介绍
各个模块介绍
| app模块 | client模块 | controller模块 | domain模块 | infrastructure模块 | start模块 | | command | api | 和一般的controller一样 | 领域对象 | common | 启动类 | | —- | —- | —- | —- | —- | —- | | handler | dto | | domain factory | config 需要注入Bootstrap的bean | | | service | context | | | tunnel mapper和rpc | | | | | | | converter | |