swagger-maven-plugin自动生成swagger.json(springmvc项目)
来源:互联网 发布:美容院会计软件 编辑:程序博客网 时间:2024/06/01 21:37
1,加入依赖:
<!-- Swagger --><dependency> <groupId>io.swagger</groupId> <artifactId>swagger-core</artifactId> <version>1.5.16</version></dependency>2,加入插件
<!--增加swagger-plugin--><plugin> <groupId>com.github.kongchen</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>3.1.4</version>(貌似别的版本不行,耗了挺长时间的) <configuration> <apiSources> <apiSource> <springmvc>true</springmvc> <locations> <location>com.gionee.geip.web</location> </locations> <schemes> <scheme>http</scheme> <scheme>https</scheme> </schemes> <host>xxxx</host> <basePath>/api</basePath> <info> <title>Swagger Maven Plugin Sample</title> <version>v1</version> <description> This is a sample. </description> <termsOfService> http://www.github.com/kongchen/swagger-maven-plugin </termsOfService> <contact> <email>xxx</email> <name>xxx</name> <url>xxx</url> </contact> <license> <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> <name>Apache 2.0</name> </license> </info> <swaggerDirectory>${basedir}/src/main/generated/swagger-ui</swaggerDirectory> </apiSource> </apiSources> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>generate</goal> </goals> </execution> </executions></plugin>3,在controller中加入注释:
@Controller@Api(value="web")//必须@RequestMapping("/geip")public class WebController { @Autowired private GeipManager geipManager; @ResponseBody @ApiOperation(value = "test", response = Void.class)//必须 @RequestMapping(value = "/test", method = RequestMethod.POST ) public String test() { return "test"; }}写上以免自己忘记
阅读全文
0 0
- swagger-maven-plugin自动生成swagger.json(springmvc项目)
- swagger-maven-plugin自动生成swagge.json(Jersey项目)
- maven-war-plugin生成swagger。json并打包到war包中(springmvc)
- springmvc集成Swagger自动生成api文档
- Maven+SpringMVC+Swagger整合
- 利用Swagger Maven Plugin生成Rest API文档
- swagger与springMVC、maven整合
- swagger和springmvc结合自动生成api接口文档
- Swagger与SpringMVC整合自动生成api(超详细)
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- Swagger与SpringMVC项目整合
- sping4 + jpa 多数据源配置, 多种实现
- <数据结构与算法>霍夫曼树与霍夫曼编码(C语言描述)
- 二维数组练习19_肿瘤检测
- Python基础学习(二)
- 【Linux】3防火墙\登陆
- swagger-maven-plugin自动生成swagger.json(springmvc项目)
- js的数据类型
- Flask零基础到项目实战(六)cookie和session(一)
- 每个月1号触发程序
- 文件上传利器SWFUpload使用
- 将json数据映射成对象的处理办法
- io-bufferedReader类
- OpenStack Heat 如何来实现和支持编排
- JAVA中的集合类