Commit 72359f3b by RuoYi

更改系统接口扫描方式

parent 2d580917
......@@ -3,6 +3,7 @@ package com.ruoyi.web.core.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.Global;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
......@@ -28,11 +29,14 @@ public class SwaggerConfig
public Docket createRestApi()
{
return new Docket(DocumentationType.SWAGGER_2)
// 详细定制
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
.select()
// 指定当前包路径
.apis(RequestHandlerSelectors.basePackage("com.ruoyi.web.controller.tool"))
// 扫描所有有注解的api,用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
......@@ -45,9 +49,13 @@ public class SwaggerConfig
{
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题:若依管理系统_接口文档")
// 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息
.contact(new Contact(Global.getName(), null, null))
// 版本
.version("版本号:" + Global.getVersion())
.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