Commit 6baf1a70 authored by 董建华's avatar 董建华

去掉swagger依赖

parent d9677f68
package cn.quantgroup.xyqb.config.swagger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.base.Predicates;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger文档框架
*/
@EnableSwagger2
@Configuration
@Deprecated
//@EnableSwagger2
//@Configuration
public class SwaggerConfig {
@Value("${openapi.swagger.on:false}")
private Boolean swaggerOn;
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.useDefaultResponseMessages(false)
.enable(swaggerOn)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.paths(PathSelectors.any())
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("xyqb-user api")
.description("用户中心接口文档")
.contact(new Contact("wenchao.ren", "", "wenchao.ren@quantgroup.cn"))
.license("Apache License Version 2.0")
.licenseUrl("https://github.com/springfox/springfox/blob/master/LICENSE")
.version("2.0")
.build();
}
// @Value("${openapi.swagger.on:false}")
//// private Boolean swaggerOn;
////
//// @Bean
//// public Docket createRestApi() {
//// return new Docket(DocumentationType.SWAGGER_2)
//// .useDefaultResponseMessages(false)
//// .enable(swaggerOn)
//// .apiInfo(apiInfo())
//// .select()
//// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
//// .paths(PathSelectors.any())
//// .paths(Predicates.not(PathSelectors.regex("/error.*")))
//// .build();
//// }
////
//// private ApiInfo apiInfo() {
//// return new ApiInfoBuilder()
//// .title("xyqb-user api")
//// .description("用户中心接口文档")
//// .contact(new Contact("wenchao.ren", "", "wenchao.ren@quantgroup.cn"))
//// .license("Apache License Version 2.0")
//// .licenseUrl("https://github.com/springfox/springfox/blob/master/LICENSE")
//// .version("2.0")
//// .build();
//// }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment