Search in sources :

Example 1 with Docket

use of springfox.documentation.spring.web.plugins.Docket in project nikita-noark5-core by HiOA-ABI.

the class SwaggerConfig method swaggerDocket.

@Bean
public Docket swaggerDocket() {
    // @formatter:off
    logger.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(webappProperties.getSwagger().getContactName(), webappProperties.getSwagger().getContactUrl(), webappProperties.getSwagger().getContactEmail());
    ApiInfo apiInfo = new ApiInfo(webappProperties.getSwagger().getTitle(), webappProperties.getSwagger().getDescription(), webappProperties.getSwagger().getVersion(), webappProperties.getSwagger().getTermsOfServiceUrl(), contact, webappProperties.getSwagger().getLicense(), webappProperties.getSwagger().getLicenseUrl());
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).forCodeGeneration(true).genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(Pageable.class).ignoredParameterTypes(java.sql.Date.class).directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class).directModelSubstitute(java.time.ZonedDateTime.class, Date.class).directModelSubstitute(java.time.LocalDateTime.class, Date.class).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build().pathMapping(Constants.HATEOAS_API_PATH).genericModelSubstitutes(ResponseEntity.class);
    watch.stop();
    logger.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
// @formatter:on
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ApiInfo(springfox.documentation.service.ApiInfo) Docket(springfox.documentation.spring.web.plugins.Docket) Date(java.util.Date) StopWatch(org.springframework.util.StopWatch) Contact(springfox.documentation.service.Contact) Bean(org.springframework.context.annotation.Bean)

Aggregations

Date (java.util.Date)1 Bean (org.springframework.context.annotation.Bean)1 ResponseEntity (org.springframework.http.ResponseEntity)1 StopWatch (org.springframework.util.StopWatch)1 ApiInfo (springfox.documentation.service.ApiInfo)1 Contact (springfox.documentation.service.Contact)1 Docket (springfox.documentation.spring.web.plugins.Docket)1