Spring Boot 入门(七)生成接口契约
我这里使用的是smart-doc
官网地址:https://smart-doc-group.github.io/#/zh-cn/?id=smart-doc
- 在项目中创建/src/main/resources/smart-doc.json
{ "outPath": "./src/main/resources/static/contract", "allInOne": true, //是否将文档合并到一个文件中,一般推荐为true "createDebugPage": true //@since 2.0.0 smart-doc支持创建可以测试的html页面,仅在AllInOne模式中起作用。 }
- 把smart-doc插件相关配置放到启动模块的pom中
com.github.shalousun smart-doc-maven-plugin 2.2.7 ./src/main/resources/smart-doc.json 测试 html
- 运行“smart-doc:html”,生成文件
- 预览契约文件
地址:http://localhost:8080/contract/debug-all.html#_HelloWorld