引入jar包依赖
<dependency>
<groupId>io.gitee.jaemon</groupId>
<artifactId>spring-adorner</artifactId>
<version>0.0.2</version>
</dependency>
api文档生成
public class AdornerApplication {
public static void main(String[] args) {
// 指定API文档生成路径(包括文件名)
String filePath = "C:\\Users\\answer\\Desktop\\api\\api.md";
// 待扫描的API接口包路径(注意修改为实际项目中的包路径)
String packageName = "com.jaemon.demo.contorller";
DocScanner scanner = DocScanner.of(
Lists.newArrayList(
"com.jaemon.demo.contorller",
"com.jaemon.demo.entity"
)
);
AdornerApplicationContext context = AdornerApplicationContext.builder()
// 文档注释扫描器
.docScanner(scanner)
.build(filePath, new String[] {packageName});
SpringAdornerStarter.generate(context);
}
}
更多使用特性,欢迎移步spring adorner源码 或者 spring adorner wiki
生成的api.md文档效果如下(简单示例)
:
版本修订记录
版本 | 日期 | 备注 | |
1.0.0 | Adorner | 2021-05-01 | Initialization Version |
API定义
1-query
- 请求地址: http://localhost:8080/adorner/order/query
- 请求方法: POST
- 请求参数
{
"key": "",
"value": ""
}
- 响应参数
{
"code": 0,
"message": "",
"data": {}
}