0
点赞
收藏
分享

微信扫一扫

Swagger的配置类

艾米吖 2022-03-11 阅读 44

Swagger的配置

@Configuration
// Swagger注解
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket webApiConfig(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("webApi")
                .apiInfo(webApiInfo())
                .select()
                .paths(Predicates.not(PathSelectors.regex("/admin/.*")))
                .paths(Predicates.not(PathSelectors.regex("/error.*")))
                .build();
    }
    private ApiInfo webApiInfo(){
        return new ApiInfoBuilder()
                .title("网站-课程中心API文档")
                .description("本文档描述了课程中心微服务接口定义")
                .version("1.0")
                .contact(new Contact("Helen", "https://*****.com", "55317332@qq.com"))
                .build();
    }
}
```
举报

相关推荐

0 条评论