Commit 34d39279 authored by 张永's avatar 张永

1

parent d31428f3
package com.egolm.admin.config; package com.egolm.admin.config;
import org.springframework.context.annotation.Bean; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder; import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; import com.egolm.common.DateUtil;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
@Configuration import springfox.documentation.service.ApiInfo;
public class SwaggerConfig { import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
@Bean import springfox.documentation.swagger2.annotations.EnableSwagger2;
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) @Configuration
.apiInfo(apiInfo()) @EnableSwagger2
.select() public class SwaggerConfig {
.apis(RequestHandlerSelectors.basePackage("com.egolm.admin"))
.paths(PathSelectors.any()) @Value("${server.servlet.context-path}")
.build(); private String contextPath;
}
@Value("${maven.build.timestamp}")
private ApiInfo apiInfo() { private String mavenBuildTime;
return new ApiInfoBuilder()
.title("B2B运营平台服务") @Bean
.description("在线文档") public Docket ProductApi() {
.termsOfServiceUrl("NO terms of service") return new Docket(DocumentationType.SWAGGER_2)
.version("1.0") .genericModelSubstitutes(DeferredResult.class)
.build(); .useDefaultResponseMessages(false)
} .forCodeGeneration(false)
.pathMapping("/")
} .select()
.build()
.apiInfo(productApiInfo());
}
private ApiInfo productApiInfo() {
String releaseTime = DateUtil.formatTimeEight(mavenBuildTime.replace("T"," ").replace("Z", ""));
return new ApiInfoBuilder()
.title("B2B后台在线接口服务-------"+contextPath+"---发布时间:-"+releaseTime)
.termsOfServiceUrl("NO terms of service")
.version("1.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