package vip.fanrong;

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 Rong on 2017/7/13.
 */
@Configuration
@EnableSwagger2
public class Swagger2 {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("vip.fanrong"))
                .paths(PathSelectors.any()).build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Spring Boot中使用Swagger2构建RESTful APIs")
                .description("初次尝试，后面会逐渐增加一些有意思的API。")
                .termsOfServiceUrl("")
                .contact("fanrong330@gmail.com")
                .version("1.0")
                .license("")
                .build();
    }

}

@@ -1259,16 +1259,105 @@
 icense(%22
+Apache 2.0%22)%0A                .licenseUrl(%22http://www.apache.org/licenses/LICENSE-2.0.html
 %22)%0A     

build license for API info