package cc.tinker.web;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Created by Eagle on 2017/6/8.
 */
@Configuration
@EnableSwagger2
public class Swagger2 {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("cc.tinker.web"))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Spring Boot中使用Swagger2构建RESTful APIs")
                .description("更多Spring Boot相关文章请关注：http://blog.didispace.com/")
                .termsOfServiceUrl("http://blog.didispace.com/")
                .contact("程序猿DD")
                .version("1.0")
                .build();
    }
}

@@ -1111,55 +1111,8 @@
 on(%22
-%E6%9B%B4%E5%A4%9ASpring Boot%E7%9B%B8%E5%85%B3%E6%96%87%E7%AB%A0%E8%AF%B7%E5%85%B3%E6%B3%A8%EF%BC%9Ahttp://blog.didispace.com/
 %22)%0A 
@@ -1150,34 +1150,8 @@
 rl(%22
-http://blog.didispace.com/
 %22)%0A 
@@ -1179,13 +1179,14 @@
 ct(%22
-%E7%A8%8B%E5%BA%8F%E7%8C%BFDD
+tinker
 %22)%0A 

添加Swagger2 管理使用API文档；