1.pom.xml配置
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
2.application.yml配置
swagger:
basePackage: com.example.demo.controller
contact: com.example.demo
title: API list
version: 1.0
3.主程序需要添加@EnableSwagger2注解
4.controller示例
@ApiOperation(value = "addAccount", httpMethod = "GET", response = Date.class, notes = "添加用户账号")
@RequestMapping(value = "getuser",method = RequestMethod.GET)
public Integer getUser() {
String keys = redisService.get("WECHAT:CUSTOMIZE:MENU:VERSION",String.class);
System.out.println(keys);
Integer userById = userService.getUserById();
return userById;
}
springboot-swagger
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 加入 maven 依赖,这里使用的 springfox.version 版本是 2.7.0 (2.9.2 有问题)...
- springboot swagger 1. 介绍 目前大部分项目都是前后端分离,或者是以服务的形式暴露RESTfu...
- SpringBoot简单介绍已经有一篇相关博客,大家可以参考这里,本篇博客主要SpringBoot实战Swagge...