Update logging Rest API
[platform-oam.git] / logging-rest-library / src / main / java / com / logging / rest / example / springbootswagger2 / configuration / Swagger2UiConfiguration.java
1 package com.logging.rest.example.springbootswagger2.configuration;
2
3 import org.springframework.context.annotation.Bean;
4 import org.springframework.context.annotation.Configuration;
5 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
6 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
7
8 import com.google.common.base.Predicates;
9
10 import springfox.documentation.builders.RequestHandlerSelectors;
11 import springfox.documentation.spi.DocumentationType;
12 import springfox.documentation.spring.web.plugins.Docket;
13 import springfox.documentation.swagger2.annotations.EnableSwagger2;
14
15 @Configuration
16 @EnableSwagger2
17 public class Swagger2UiConfiguration extends WebMvcConfigurerAdapter  {
18         @Bean
19         public Docket api() {
20                 // @formatter:off
21                 return new Docket(DocumentationType.SWAGGER_2)
22                                 .select()
23                                 .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
24                                 .build()
25                                 ;
26                 // @formatter:on
27         }
28         
29         @Override
30         public void addResourceHandlers(ResourceHandlerRegistry registry) {
31                 registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
32                 registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
33         }
34
35
36 }