1. @Configuration
    2. @EnableSwagger2
    3. public class SwaggerConfiguration {
    4. @Bean
    5. public Docket createRestApi() {
    6. return new Docket(DocumentationType.SWAGGER_2)
    7. .select()
    8. .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
    9. .paths(PathSelectors.any())
    10. .build()
    11. .apiInfo(apiInfo());
    12. }
    13. private ApiInfo apiInfo() {
    14. return new ApiInfoBuilder()
    15. .title("xxx")
    16. .description("API文档")
    17. .termsOfServiceUrl("http://lcmoled.com/")
    18. .version("1.0")
    19. .build();
    20. }
    21. }