|
|
@ -1,5 +1,6 @@
|
|
|
|
package com.ruoyi.framework.config;
|
|
|
|
package com.ruoyi.framework.config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import springfox.documentation.builders.ApiInfoBuilder;
|
|
|
|
import springfox.documentation.builders.ApiInfoBuilder;
|
|
|
@ -17,24 +18,35 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@EnableSwagger2
|
|
|
|
@EnableSwagger2
|
|
|
|
public class SwaggerConfig {
|
|
|
|
public class SwaggerConfig {
|
|
|
|
|
|
|
|
/** 系统基础配置*/
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private RuoYiConfig ruoYiConfig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 创建API
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public Docket createRestApi() {
|
|
|
|
public Docket createRestApi() {
|
|
|
|
return new Docket(DocumentationType.SWAGGER_2)
|
|
|
|
return new Docket(DocumentationType.SWAGGER_2)
|
|
|
|
|
|
|
|
//详细定制
|
|
|
|
.apiInfo(apiInfo())
|
|
|
|
.apiInfo(apiInfo())
|
|
|
|
.select()
|
|
|
|
.select()
|
|
|
|
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.*.*.controller"))
|
|
|
|
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.*.*.controller"))
|
|
|
|
|
|
|
|
//扫描所有
|
|
|
|
.apis(RequestHandlerSelectors.any())
|
|
|
|
.apis(RequestHandlerSelectors.any())
|
|
|
|
.paths(PathSelectors.any())
|
|
|
|
.paths(PathSelectors.any())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ApiInfo apiInfo() {
|
|
|
|
private ApiInfo apiInfo() {
|
|
|
|
|
|
|
|
// 用ApiInfoBuilder进行定制
|
|
|
|
return new ApiInfoBuilder()
|
|
|
|
return new ApiInfoBuilder()
|
|
|
|
.title("系统接口列表")
|
|
|
|
.title("系统接口列表")
|
|
|
|
.description("API接口测试平台\",\n" +
|
|
|
|
.description("API接口测试平台\",\n" +
|
|
|
|
" \"提供后台所有Restful接口\",")
|
|
|
|
" \"提供后台所有Restful接口\",")
|
|
|
|
.termsOfServiceUrl("http://localhost/swagger-ui.html")
|
|
|
|
.termsOfServiceUrl("http://localhost/swagger-ui.html")
|
|
|
|
.contact(new Contact("RuoYi", "https://gitee.com/y_project/RuoYi", "1403014932@qq.com"))
|
|
|
|
.contact(new Contact(ruoYiConfig.getName(), "https://gitee.com/y_project/RuoYi", "1403014932@qq.com"))
|
|
|
|
.version("1.1.0")
|
|
|
|
.version("1.1.0")
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|