Spring Boot 2.X整合Swagger2

时间:2024-11-04 01:36:43

1、在pom.xml中添加swagger2的坐标

Spring Boot 2.X整合Swagger2

3、新建一个Swagger2的配置类加注解@EnableSwagger2@Configuration

Spring Boot 2.X整合Swagger2

5、在Controller层添加API注解@Api("用户接口")氆尧彻性@ApiOperation("获取所有用户")

Spring Boot 2.X整合Swagger2

7、点击try it out!进行测试我这里写了一个查询所有用户的列子

Spring Boot 2.X整合Swagger2
© 2025 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com