Created
July 24, 2017 16:42
-
-
Save indrabasak/6c20d618324a6e14950b98354ee6d169 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableSwagger2 | |
public class MySwaggerConfiguration { | |
@Bean | |
public Docket api() { | |
return new Docket(DocumentationType.SWAGGER_2) | |
.groupName("myApis") | |
.select() | |
.apis(exactPackage("com.basaki.example.controller")) | |
.paths(PathSelectors.any()) | |
.build() | |
.apiInfo(apiInfo("My Example API", "API Example")); | |
} | |
private ApiInfo apiInfo(String title, String description) { | |
Contact contact = new Contact("Indra Basak", "", | |
"developer@gmail.com"); | |
return new ApiInfo(title, description, "1.0", "terms of service url", | |
contact, "license", "license url"); | |
} | |
private static Predicate exactPackage(final String pkg) { | |
return input -> declaringClass(input).getPackage().getName().equals( | |
pkg); | |
} | |
private static Class declaringClass(RequestHandler input) { | |
return input.declaringClass(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment