# generatePostmanCollection **Repository Path**: qianli/generatePostmanCollection ## Basic Information - **Project Name**: generatePostmanCollection - **Description**: 生成 postman 集合 json 文件 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2020-04-21 - **Last Updated**: 2021-06-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 通过注解和反射解析项目中的controller生成postman collection json文件。 ### 使用 1. 根据自己的需要更改 PostmanGenerate 文件中的配置 ``` public static void main(String[] args) { String scanPackage = "com.hlql.postman.modules"; String apiName = "xxxx项目接口"; String destFilePath = "/Users/tom/study-tools/postman/target/" + apiName + DateUtil.today() + ".json"; PostmanConfiguration postmanConfiguration = new PostmanConfiguration(scanPackage, apiName, destFilePath); PostmanGenerate postmanGenerate = new PostmanGenerate(postmanConfiguration); postmanGenerate.generateJson(); } ``` 2. 运行 main 方法生成 project.json 3. 打开 postman 导入 project.json 4. 配置 postman 环境变量 ![环境变量](doc/postman-environment.jpg) ![导入的 Collection 目录](doc/project-directory.png) ![请求文档](doc/request-doc.png)