1、pom文件添加
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
2、新建config包,写入swaggerConfig配置类
@Configuration //配置类
@EnableSwagger2 // 开启Swagger2的自动配置
public class swaggerConfig {
}
3、编写Controller
@RestController
@Api(tags = "excel控制层")
public class ExcelController {
@GetMapping("/downloadExcel")
public void download(HttpServletResponse httpServletResponse){
}
@PostMapping("/upload")
public void upload(MultipartFile file){
}
}
4、启动 查看 http://localhost:8080/swagger-ui.html#/