springfox.documentation.builders.PathSelectors.ant()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(566)

本文整理了Java中springfox.documentation.builders.PathSelectors.ant()方法的一些代码示例,展示了PathSelectors.ant()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PathSelectors.ant()方法的具体详情如下:
包路径:springfox.documentation.builders.PathSelectors
类名称:PathSelectors
方法名:ant

PathSelectors.ant介绍

暂无

代码示例

代码示例来源:origin: SpringForAll/spring-boot-starter-swagger

basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));
basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));

代码示例来源:origin: mahanhz/clean-architecture-example

@Bean
public Docket api() {
  return new Docket(DocumentationType.SWAGGER_2)
      .select()
      .apis(RequestHandlerSelectors.basePackage("com.example.clean.app.web.controller"))
      .paths(PathSelectors.ant("/**"))
      .build();
}

代码示例来源:origin: cn.home1/oss-lib-swagger-spring-boot-1.4.1.RELEASE

private Predicate<String> errorPath() {
 return ant(this.serverProperties.getError().getPath());
}

代码示例来源:origin: net.guerlab.spring/guerlab-spring-swagger2-starter

private static void setApiSelectorBuilder(Docket docket, DocketProperties properties) {
  ApiSelectorBuilder apiSelectorBuilder = docket.select();
  if (StringUtils.isNotBlank(properties.getBasePackage())) {
    if (DocketProperties.ALL_PACKAGE.equals(properties.getBasePackage())) {
      apiSelectorBuilder.apis(RequestHandlerSelectors.any());
    } else {
      apiSelectorBuilder.apis(RequestHandlerSelectors.basePackage(properties.getBasePackage()));
    }
  }
  if (StringUtils.isNotBlank(properties.getPathRegex())) {
    apiSelectorBuilder.paths(PathSelectors.regex(properties.getPathRegex()));
  }
  if (StringUtils.isNotBlank(properties.getPathAntPattern())) {
    apiSelectorBuilder.paths(PathSelectors.ant(properties.getPathAntPattern()));
  }
  apiSelectorBuilder.build();
}

代码示例来源:origin: castlemock/castlemock

@Bean
public Docket api() {
  Parameter  authorizationParameter =
      new ParameterBuilder().name("Authorization")
      .modelRef(new ModelRef("string"))
          .parameterType("header")
          .required(false).build();
  return new Docket(DocumentationType.SWAGGER_2)
      .select()
      .apis(RequestHandlerSelectors.any())
      .paths(PathSelectors.ant("/api/rest/**"))
      .build()
      .apiInfo(apiInfo())
      .globalOperationParameters(Collections.singletonList(authorizationParameter));
}

代码示例来源:origin: chillzhuang/blade-tool

@Bean
public Docket api(SwaggerProperties swaggerProperties) {
  // base-path处理
  if (swaggerProperties.getBasePath().size() == 0) {
    swaggerProperties.getBasePath().add(BASE_PATH);
  }
  //noinspection unchecked
  List<Predicate<String>> basePath = new ArrayList();
  swaggerProperties.getBasePath().forEach(path -> basePath.add(PathSelectors.ant(path)));
  // exclude-path处理
  if (swaggerProperties.getExcludePath().size() == 0) {
    swaggerProperties.getExcludePath().add(DEFAULT_EXCLUDE_PATH);
  }
  List<Predicate<String>> excludePath = new ArrayList<>();
  swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
  //noinspection Guava
  return new Docket(DocumentationType.SWAGGER_2)
    .host(swaggerProperties.getHost())
    .apiInfo(apiInfo(swaggerProperties)).select()
    .apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()))
    .paths(Predicates.and(Predicates.not(Predicates.or(excludePath)), Predicates.or(basePath)))
    .build()
    .securitySchemes(Collections.singletonList(securitySchema()))
    .securityContexts(Collections.singletonList(securityContext()))
    .pathMapping("/");
}

代码示例来源:origin: qq53182347/liugh-parent

/**
 * 可以注入多个doket,也就是多个版本的api,可以在看到有三个版本groupName不能是重复的,v1和v2是ant风格匹配,配置文件
 * @return
 */
@Bean
public Docket api() {
  //可以添加多个header或参数
  ParameterBuilder aParameterBuilder = new ParameterBuilder();
  aParameterBuilder
      .parameterType("header")
      .name("Authorization")
      .description("header中Authorization字段用于认证")
      .modelRef(new ModelRef("string"))
      //非必需,这里是全局配置,然而在登陆的时候是不用验证的
      .required(false).build();
  List<Parameter> aParameters = new ArrayList<Parameter>();
  aParameters.add(aParameterBuilder.build());
  return new Docket(DocumentationType.SWAGGER_2).groupName("v1").select()
      .apis(RequestHandlerSelectors.basePackage("com.liugh.controller"))
      .paths(PathSelectors.ant("/**")).build().apiInfo(apiInfo1()).globalOperationParameters(aParameters);
}

代码示例来源:origin: springfox/springfox-demos

@Bean
SecurityContext securityContext() {
  AuthorizationScope readScope = new AuthorizationScope("read:pets", "read your pets");
  AuthorizationScope[] scopes = new AuthorizationScope[1];
  scopes[0] = readScope;
  SecurityReference securityReference = SecurityReference.builder()
      .reference("petstore_auth")
      .scopes(scopes)
      .build();
  return SecurityContext.builder()
      .securityReferences(newArrayList(securityReference))
      .forPaths(ant("/api/pet.*"))
      .build();
}

代码示例来源:origin: saleson/fm-cloud

.select()
.paths(PathSelectors.ant("/gray/**"))
.build()

代码示例来源:origin: SpringCloud/spring-cloud-gray

.select()
.paths(PathSelectors.ant("/gray/**"))
.build()

代码示例来源:origin: Swagger2Markup/spring-swagger2markup-demo

@Bean
public Docket restApi() {
  return new Docket(DocumentationType.SWAGGER_2)
      .apiInfo(apiInfo())
      .securitySchemes(asList(
          new OAuth(
            "petstore_auth",
            asList(new AuthorizationScope("write_pets", "modify pets in your account"),
                new AuthorizationScope("read_pets", "read your pets")),
              Arrays.<GrantType>asList(new ImplicitGrant(new LoginEndpoint("http://petstore.swagger.io/api/oauth/dialog"), "tokenName"))
          ),
          new ApiKey("api_key", "api_key", "header")
      ))
      .select()
      .paths(Predicates.and(ant("/**"), Predicates.not(ant("/error")), Predicates.not(ant("/management/**")), Predicates.not(ant("/management*"))))
      .build();
}

代码示例来源:origin: liuht777/Taroco

basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));

代码示例来源:origin: liuht777/Taroco

basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));

代码示例来源:origin: com.didispace/spring-boot-starter-swagger

basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));
basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));

代码示例来源:origin: club.zhcs/axe-swagger

basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));
basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));

代码示例来源:origin: com.github.fosin/cdp-swagger

basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));
basePath.add(PathSelectors.ant(path));
excludePath.add(PathSelectors.ant(path));

相关文章

微信公众号

最新文章

更多