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

1

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