首页 > 技术文章 > springfox.documentation.spi.DocumentationType配置示例

jeffen 2016-12-14 09:41 原文

Java Code Examples for springfox.documentation.spi.DocumentationType

The following are top voted examples for showing how to use springfox.documentation.spi.DocumentationType. 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 product more good examples. 

Example 1
Project: Learny---Server   File: SwaggerConfig.java View source code6 votesvote downvote up
@Beanpublic Docket learnyApi() {return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class)).paths(PathSelectors.any()).build().pathMapping("/").directModelSubstitute(LocalDate.class,String.class).genericModelSubstitutes(ResponseEntity.class).useDefaultResponseMessages(false).securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));}
Example 2
Project: jhipster_myapp   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();Docket swaggerSpringMvcPlugin = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)) // and by paths.build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return swaggerSpringMvcPlugin;}
Example 3
Project: jhipster-sample-app-gradle   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();ApiInfo apiInfo = new ApiInfo(
        jHipsterProperties.getSwagger().getTitle(),
        jHipsterProperties.getSwagger().getDescription(),
        jHipsterProperties.getSwagger().getVersion(),
        jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
        jHipsterProperties.getSwagger().getContact(),
        jHipsterProperties.getSwagger().getLicense(),
        jHipsterProperties.getSwagger().getLicenseUrl());Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 4
Project: menuber   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(org.joda.time.LocalDate.class, String.class).directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class).directModelSubstitute(org.joda.time.DateTime.class, Date.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 5
Project: jhipster-sample-app-java7   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();ApiInfo apiInfo = new ApiInfo(
        jHipsterProperties.getSwagger().getTitle(),
        jHipsterProperties.getSwagger().getDescription(),
        jHipsterProperties.getSwagger().getVersion(),
        jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
        jHipsterProperties.getSwagger().getContact(),
        jHipsterProperties.getSwagger().getLicense(),
        jHipsterProperties.getSwagger().getLicenseUrl());Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(org.joda.time.LocalDate.class, String.class).directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class).directModelSubstitute(org.joda.time.DateTime.class, Date.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 6
Project: bugkillers   File: SpringfoxConfig2.java View source code6 votesvote downvote up
@Beanpublic Docket swaggerSpringMvcPlugin() {//        return new Docket(DocumentationType.SWAGGER_2);return new Docket(DocumentationType.SWAGGER_2)//                .groupName("bugkillers").select()//Ignores controllers annotated with @CustomIgnore//                .apis(not(withClassAnnotation(CustomIgnore.class)) //Selection by RequestHandler.paths(paths()) // and by paths.build().apiInfo(apiInfo()).securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));}
Example 7
Project: springfox-demos   File: Application.java View source code6 votesvote downvote up
@Beanpublic Docket petApi() {return new Docket(DocumentationType.SWAGGER_2).groupName("full-petstore-api").apiInfo(apiInfo()).select().paths(petstorePaths()).build();}
Example 8
Project: flipper-reverse-image-search   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(org.joda.time.LocalDate.class, String.class).directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class).directModelSubstitute(org.joda.time.DateTime.class, Date.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 9
Project: jhipster-ionic   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(org.joda.time.LocalDate.class, String.class).directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class).directModelSubstitute(org.joda.time.DateTime.class, Date.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 10
Project: barweb   File: ApiDocumentationConfig.java View source code6 votesvote downvote up
@Beanpublic Docket petApi() {return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build().pathMapping("/api").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).globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build())).securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext()));}
Example 11
Project: jhipster-sample-app   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();ApiInfo apiInfo = new ApiInfo(
        jHipsterProperties.getSwagger().getTitle(),
        jHipsterProperties.getSwagger().getDescription(),
        jHipsterProperties.getSwagger().getVersion(),
        jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
        jHipsterProperties.getSwagger().getContact(),
        jHipsterProperties.getSwagger().getLicense(),
        jHipsterProperties.getSwagger().getLicenseUrl());Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 12
Project: availability   File: SwaggerConfig.java View source code6 votesvote downvote up
@Beanpublic Docket api() {return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build().pathMapping("/").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).globalResponseMessage(RequestMethod.GET,
          newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build())).securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext())).enableUrlTemplating(true);}
Example 13
Project: jhipster-sample-app-mongodb   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();ApiInfo apiInfo = new ApiInfo(
        jHipsterProperties.getSwagger().getTitle(),
        jHipsterProperties.getSwagger().getDescription(),
        jHipsterProperties.getSwagger().getVersion(),
        jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
        jHipsterProperties.getSwagger().getContact(),
        jHipsterProperties.getSwagger().getLicense(),
        jHipsterProperties.getSwagger().getLicenseUrl());Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 14
Project: spring-swagger2markup-demo   File: SwaggerConfig.java View source code6 votesvote downvote up
@Beanpublic Docket restApi() {return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().paths(Predicates.and(ant("/**"), Predicates.not(ant("/error")))).build();}
Example 15
Project: cqrs-axon   File: Swagger2Configuration.java View source code6 votesvote downvote up
@Beanpublic Docket petApi() {return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build().pathMapping("/").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).globalResponseMessage(RequestMethod.GET,
					newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build())).securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext())).enableUrlTemplating(true);}
Example 16
Project: fullstop   File: SwaggerConfig.java View source code6 votesvote downvote up
@Beanpublic Docket customImplementation() {return new Docket(DocumentationType.SWAGGER_2) //.apiInfo(apiInfo())                    //.select()                              //.paths(fullstopOnlyEndpoints())        //.build();}
Example 17
Project: jhipster-sample-app-elasticsearch   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();ApiInfo apiInfo = new ApiInfo(
        jHipsterProperties.getSwagger().getTitle(),
        jHipsterProperties.getSwagger().getDescription(),
        jHipsterProperties.getSwagger().getVersion(),
        jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
        jHipsterProperties.getSwagger().getContact(),
        jHipsterProperties.getSwagger().getLicense(),
        jHipsterProperties.getSwagger().getLicenseUrl());Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 18
Project: JTL-FIleService   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(org.joda.time.LocalDate.class, String.class).directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class).directModelSubstitute(org.joda.time.DateTime.class, Date.class).directModelSubstitute(java.time.LocalDate.class, String.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
Example 19
Project: ABC-Go   File: SwaggerConfiguration.java View source code6 votesvote downvote up
/**
 * Swagger Springfox configuration.
 */@Beanpublic Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");StopWatch watch = new StopWatch();
    watch.start();Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).directModelSubstitute(org.joda.time.LocalDate.class, String.class).directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class).directModelSubstitute(org.joda.time.DateTime.class, Date.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());return docket;}
来源:http://www.programcreek.com/java-api-examples/index.php?api=springfox.documentation.spi.DocumentationType


来自为知笔记(Wiz)


推荐阅读