在springboot中使用swagger2
2024-09-22 08:18:37
1、在springboot中使用swagger的话,首先在pom文件中引入依赖
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
2、创建配置类
@Configuration
@EnableSwagger2
public class Swagger2Config{ @Bean
public Docket swaggerSpringMvcPlugin(){
return new Docket(DocunmentationType.Swagger_2).select().apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).build();
} }
3、在controller类上加Api注解
最新文章
- Python中的threading
- [JS7] 显示从0到99的100个数字
- MyEclipse8.6中提交SVN报错
- Lambda表达式【转】
- 搭建scala开发环境
- poj 2441 Arrange the Bulls(状态压缩dp)
- 老李分享:接口测试之jmeter
- bootstrap快速入门笔记(三)响应式,行,列,偏移量,排序
- 解决NSURLConnection finished with error - code -1100错误
- Python学习笔记 - 切片
- 7 Servlet 会话技术
- Leetcode: Find Permutation(Unsolve lock problem)
- CEBX格式的文档如何转换为PDF格式文档、DOCX文档?
- js方法参数中含有单引号双引号的处理
- Linux网络 - 数据包的接收过程【转】
- VS2015 将*.xaml.cs文件包裹在*.xaml文件下
- Nginx网站实现ssl安全套接字
- 微信小程序---分包加载(subpackages)及报错
- 关于Git的总结
- MUI class=";mui-switch"; 开关 默认为选中