我爱java系列---【springboot项目集成swagger2】

网上教程很多,这个是个人收藏的,感谢作者写出这么优秀的文章,小白的福音!
springboot集成swagger2:https://www.liangzl.com/get-article-detail-114901.html
post请求map/json参数 和 map/json返回 自定义map注解实现 附源码:https://blog.csdn.net/a704397849/article/details/100123686
下面这个是对本文档的补充,把不同模块的接口进行分组管理,更清爽。

@Configuration
public class SwaggerConfig {

private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("模板项目——数据代理模块构建RESTful API")
.description("重构-数据代理")
.termsOfServiceUrl("")
.contact("作者姓名")
.version("1.0")
.build();
}

@Bean
public Docket createRestApi1() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("路由模块接口")
.apiInfo(apiInfo())
.host("188.10.106.47:8099")
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.routingformo.controller"))
.paths(PathSelectors.any())
.build();
}

@Bean
public Docket createRestApi2() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("二级网关模块接口")
.apiInfo(apiInfo())
.host("188.10.106.47:8099"
愿你走出半生,归来仍是少年!
原文地址:https://www.cnblogs.com/hujunwei/p/11865815.html