Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. @Configuration
  2. @EnableSwagger2WebMvc
  3. @Import(SpringDataRestConfiguration.class)
  4. public class SwaggerConfig {
  5.     @Bean
  6.     public Docket api() {
  7.         return new Docket(DocumentationType.SWAGGER_2)
  8.                 .select()
  9.                 .apis(RequestHandlerSelectors.any())
  10.                 .paths(PathSelectors.any())
  11.                 .build()
  12.                 .apiInfo(apiInfo())
  13.                 .securitySchemes(Arrays.asList(apiKey()));
  14.     }
  15.  
  16.     private ApiInfo apiInfo() {
  17.         return new ApiInfoBuilder().title("Gametrade REST API")
  18.                 .description("API for the Gametrade application").termsOfServiceUrl("")
  19.                 .contact(new Contact("Colin van Hooren", "", "colin.vanhooren@gmail.com"))
  20.                 .license("Apache License Version 2.0")
  21.                 .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0")
  22.                 .version("1.0")
  23.                 .build();
  24.     }
  25.  
  26.     private ApiKey apiKey() {
  27.         return new ApiKey("Bearer", "Authorization", "header");
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement