Commit 6e0e87bf by 梁家彪

添加Swagger配置

parent 7af1f5eb
......@@ -108,6 +108,7 @@
<scope>compile</scope>
</dependency>
<!--若此依赖下载失败则手动安装到本地仓库mvn install:install-file -Dfile=D:\nnjcy-data-model\model-server\src\main\resources\lib\aspose-words-19.5.jar -DgroupId=com.aspose -DartifactId=aspose-words -Dversion=19.5 -Dpackaging=jar-->
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
......
package com.zq.model;
import org.springframework.beans.factory.annotation.Value;
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;
/**
* @author bici
*/
@Configuration
@EnableSwagger2
public class Swagger {
@Value("${spring.cloud.config.profile:product}")
private String profile;
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("可视化平台1")
.enable(!"product".equals(profile)) //生产环境关闭
.select()
.apis(RequestHandlerSelectors.basePackage("com.zq.instrument.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("可视化平台2")
.description("可视化平台3")
.build();
}
@Bean
public Docket app() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("可视化平台4")
.enable(!"prod".equals(profile)) //生产环境关闭
.select()
.apis(RequestHandlerSelectors.basePackage("com.zq.instrument.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(appInfo());
}
private ApiInfo appInfo() {
return new ApiInfoBuilder()
.title("可视化平台5")
.description("可视化平台6")
.build();
}
}
\ No newline at end of file
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