当前位置:   article > 正文

SpringBoot 入门到精通-Swagger2 配置多个basePackage_swagger如何注册两个包路径

swagger如何注册两个包路径
@Bean(value = "defaultApi2")
public Docket defaultApi2() {
    Docket docket=new Docket(DocumentationType.SWAGGER_2)
            .globalResponseMessage(RequestMethod.GET, responseMessageList)
            .globalResponseMessage(RequestMethod.POST, responseMessageList)
            .globalResponseMessage(RequestMethod.PUT, responseMessageList)
            .globalResponseMessage(RequestMethod.DELETE, responseMessageList)
            .apiInfo(apiInfo())
            //分组名称
            .groupName("业务接口")
            .select()
            //这里指定Controller扫描包路径
            .apis(  Predicates.or(
                    RequestHandlerSelectors.basePackage("com.xxx.application.controller"),
                    RequestHandlerSelectors.basePackage("com.xxx.userinterface.controller")
                    ))
            .paths(PathSelectors.any())
            .build()
            .securitySchemes(security())
            .ignoredParameterTypes(LoginUser.class);;
    return docket;
}
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/656168
推荐阅读
相关标签
  

闽ICP备14008679号