Java Code Examples for springfox.documentation.builders.RequestHandlerSelectors

The following are top voted examples for showing how to use springfox.documentation.builders.RequestHandlerSelectors. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: smarti   File: SwaggerConfiguration.java   View source code 7 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(new ApiInfo(
                    "Smarti",
                    "the smart in assistify",
                    apiVersion,
                    null,
                    new Contact(
                            apiContactName,
                            apiContactUrl,
                            "[email protected]"
                    ),
                    "Apache 2.0",
                    "https://www.apache.org/licenses/LICENSE-2.0",
                    Collections.emptyList()
            ))
            .select()
                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
                .paths(PathSelectors.any())
                .build()
            .securitySchemes(Arrays.asList(authToken(), basicAuth()))
            .securityContexts(Arrays.asList(publicContext(), defaultContext()))
            .ignoredParameterTypes(AuthContext.class)
            .directModelSubstitute(ObjectId.class, String.class);
}
 
Example 2
Project: spring-boot-oauth2-demo   File: SpringfoxConfig.java   View source code 7 votes vote down vote up
@Bean
public Docket practiceApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.sdcuike.practice"))
            .paths(PathSelectors.any())
            .build()
            .pathMapping("/")
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                            typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder()
                            .code(500)
                            .message("500 message")
                            .responseModel(new ModelRef("Error"))
                            .build()))
            .enableUrlTemplating(true)
            .tags(new Tag("Pet Service", "All apis relating to pets"));
}
 
Example 3
Project: plumdo-work   File: Swagger2Configuration.java   View source code 6 votes vote down vote up
@Bean
public Docket createRestApi() {
	
    return new Docket(DocumentationType.SWAGGER_2)
    		.useDefaultResponseMessages(false)
    		.globalResponseMessage(RequestMethod.GET, getDefaultResponseMessage())
    		.globalResponseMessage(RequestMethod.POST, getDefaultResponseMessage())
    		.globalResponseMessage(RequestMethod.PUT, getDefaultResponseMessage())
    		.globalResponseMessage(RequestMethod.DELETE, getDefaultResponseMessage())
            .directModelSubstitute(Timestamp.class, Date.class)
            .tags(new Tag("默认标签", "定义全局默认标签"),getTags())
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.plumdo.form"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 4
Project: spring-boot-jwt   File: SwaggerConfig.java   View source code 6 votes vote down vote up
@Bean
public Docket api() {
  return new Docket(DocumentationType.SWAGGER_2)//
      .select()//
      .apis(RequestHandlerSelectors.any())//
      .paths(Predicates.not(PathSelectors.regex("/error")))//
      .build()//
      .apiInfo(metadata())//
      .useDefaultResponseMessages(false)//
      .securitySchemes(new ArrayList<>(Arrays.asList(new ApiKey("Bearer %token", "Authorization", "Header"))))//
      .tags(new Tag("users", "Operations about users"))//
      .tags(new Tag("ping", "Just a ping"))//
      .genericModelSubstitutes(Optional.class);

}
 
Example 5
Project: spring-boot-oauth2-demo   File: SpringfoxConfig.java   View source code 6 votes vote down vote up
@Bean
public Docket practiceApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.sdcuike.practice"))
            .paths(PathSelectors.any())
            .build()
            .pathMapping("/")
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                            typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET,
                    newArrayList(new ResponseMessageBuilder()
                            .code(500)
                            .message("500 message")
                            .responseModel(new ModelRef("Error"))
                            .build()))
            .enableUrlTemplating(true)
            .tags(new Tag("Pet Service", "All apis relating to pets"));
}
 
Example 6
Project: spring-backend-boilerplate   File: SpringfoxConfiguration.java   View source code 6 votes vote down vote up
public Docket api() {
	return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
												  .select()
												  .apis(RequestHandlerSelectors.any())

												  .paths(PathSelectors.any())
												  .build()
												  .pathMapping("/")
												  .directModelSubstitute(LocalDate.class, String.class)
												  .genericModelSubstitutes(ResponseEntity.class)
												  .alternateTypeRules(AlternateTypeRules.newRule(typeResolver.resolve(
														  DeferredResult.class,
														  typeResolver.resolve(ResponseEntity.class,
																			   WildcardType.class)),
																								 typeResolver.resolve(
																										 WildcardType.class)))
												  .useDefaultResponseMessages(false);
}
 
Example 7
Project: microservice-email   File: SwaggerDocumentationConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket customImplementation() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.basePackage("io.pestakit.email.api"))
            .build()
            .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
            .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
            .apiInfo(apiInfo());
}
 
Example 8
Project: Code-warehouse   File: SwaggerDocumentationConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket customImplementation() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.basePackage("io.swagger.api"))
            .build()
            .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
            .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
            .apiInfo(apiInfo());
}
 
Example 9
Project: springboot-cloud   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.crossoverJie.sbcorder.controller"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 10
Project: borabeber-api   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
	return new Docket(DocumentationType.SWAGGER_2).select()
			.apis(RequestHandlerSelectors.basePackage("com.borabeber.api.controllers"))
			.paths(PathSelectors.any()).build()
			.apiInfo(apiInfo());
}
 
Example 11
Project: replan_optimizer_v2   File: SwaggerDocumentationConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket customImplementation(){
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
                .apis(RequestHandlerSelectors.basePackage("io.swagger.api"))
                .build()
            .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
            .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
            .apiInfo(apiInfo());
}
 
Example 12
Project: nice-api   File: WebMvcConfiguration.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build();
}
 
Example 13
Project: project-template   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .groupName("Template")
            .select()
            .apis(RequestHandlerSelectors.basePackage(TemplateApplication.class.getPackage().getName()))
            .paths(PathSelectors.any())
            .build()
            .apiInfo(getApiInfo());
}
 
Example 14
Project: REST-Web-Services   File: SwaggerConfig.java   View source code 5 votes vote down vote up
/**
 * Configure Spring Fox.
 *
 * @return The spring fox docket.
 */
@Bean
public Docket productApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.web.web.controller"))
            .paths(any())
            .build()
            .apiInfo(metaData());
}
 
Example 15
Project: mirrorgate   File: OpenApiConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.bbva.arq.devops.ae.mirrorgate.api"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 16
Project: FCat   File: SwaggerConfiguration.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
	return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
			.select()
			.apis(RequestHandlerSelectors.basePackage(this.basePackage))
			.paths(PathSelectors.any()).build();
}
 
Example 17
Project: cmc-claim-store   File: SwaggerConfiguration.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
        .select()
        .apis(RequestHandlerSelectors.basePackage(ClaimStoreApplication.BASE_PACKAGE_NAME + ".controllers"))
        .paths(PathSelectors.any())
        .build();
}
 
Example 18
Project: xbin-store   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage(basePackage))
            .paths(PathSelectors.any())
            .build();
}
 
Example 19
Project: xbin-store   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage(basePackage))
            .paths(PathSelectors.any())
            .build();
}
 
Example 20
Project: xbin-store   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage(basePackage))
            .paths(PathSelectors.any())
            .build();
}
 
Example 21
Project: xbin-store   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage(basePackage))
            .paths(PathSelectors.any())
            .build();
}
 
Example 22
Project: xbin-store   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage(basePackage))
            .paths(PathSelectors.any())
            .build();
}
 
Example 23
Project: xbin-store   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage(basePackage))
            .paths(PathSelectors.any())
            .build();
}
 
Example 24
Project: mumu-swagger   File: SwaggerConfig.java   View source code 5 votes vote down vote up
/**
 * Create rest api docket.
 *
 * @return the docket
 */
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            //.groupName("用户管理")
            .forCodeGeneration(true)
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.lovecws.mumu.swagger"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 25
Project: amv-access-api-poc   File: SwaggerConfiguration.java   View source code 5 votes vote down vote up
@Bean
public Docket models() {
    return new Docket(DocumentationType.SWAGGER_2)
            .groupName("models")
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.regex("/model-.+"))
            .build()
            .apiInfo(apiInfo());
}
 
Example 26
Project: LushX   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("cn.mailu.lushx"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 27
Project: kbase-doc   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.eastrobot.web"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 28
Project: petstore-inventory   File: InventoryApplication.java   View source code 5 votes vote down vote up
@Bean
	public Docket api() {
		return new Docket(DocumentationType.SWAGGER_2)
				.select()
				.apis(RequestHandlerSelectors.any())
				.paths(PathSelectors.any())
				.build();
//		/swagger-ui.html
	}
 
Example 29
Project: spring-boot-template   File: SwaggerConfiguration.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
        .useDefaultResponseMessages(false)
        .select()
        .apis(RequestHandlerSelectors.basePackage(Application.class.getPackage().getName() + ".controllers"))
        .paths(PathSelectors.any())
        .build();
}
 
Example 30
Project: ecommerce-checkout-api-server   File: SwaggerDocumentationConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket customImplementation(){
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
                .apis(RequestHandlerSelectors.basePackage("io.swagger.api"))
                .build()
            .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
            .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
            .apiInfo(apiInfo());
}
 
Example 31
Project: busi-support   File: Swager2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("org.prcode.web"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 32
Project: zhihu-spider   File: SwaggerDocumentationConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket customImplementation() {
	return new Docket(DocumentationType.SWAGGER_2).select()
			.apis(RequestHandlerSelectors.basePackage("com.wei.you.zhihu.spider.controller")).build()
			.directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
			.directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo());
}
 
Example 33
Project: projectindoorweb   File: IndoorApiDescriptionHelper.java   View source code 5 votes vote down vote up
/**
 * Creates for the dynamic documentation necessary REST API Docket.
 * @param typeResolver The type resolver. Must not be <code>null</code>.
 * @return The requested REST API Docket.
 */
public static Docket createIndoorRestApiDocket(TypeResolver typeResolver) {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(Predicates.not(PathSelectors.regex(EXCLUDE_ERROR_PATH_REGEX)))
            .build()
            .pathMapping(ROOT_PATH)
            .directModelSubstitute(LocalDate.class,
                    String.class)
            .genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(
                    newRule(typeResolver.resolve(DeferredResult.class,
                            typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                            typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .enableUrlTemplating(false)
            .tags(new Tag(TAG_NAME, TAG_DESCRIPTION)).apiInfo(apiInfo());
}
 
Example 34
Project: demo-springboot   File: Swagger2.java   View source code 5 votes vote down vote up
@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("vip.fanrong"))
            .paths(PathSelectors.any())
            .build();
}
 
Example 35
Project: microservices-spring   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build();
}
 
Example 36
Project: microservices-spring   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build();
}
 
Example 37
Project: microservices-spring   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build();
}
 
Example 38
Project: generic-rest-api   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() { 
    return new Docket(DocumentationType.SWAGGER_2)  
      .select()                             
      .apis(RequestHandlerSelectors.any())              
      .paths(PathSelectors.any())                          
      .build()
      .apiInfo(apiInfo())
      .useDefaultResponseMessages(false)                                   
      ;    
    
}
 
Example 39
Project: openaffect-server   File: SwaggerDocumentationConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket customImplementation(){
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
                .apis(RequestHandlerSelectors.basePackage("io.openaffect.api"))
                .build()
            .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
            .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
            .apiInfo(apiInfo());
}
 
Example 40
Project: product-management-system   File: SwaggerConfig.java   View source code 5 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .useDefaultResponseMessages(false)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(Predicates.not(PathSelectors.regex("/error.*")))
            .build();
}