diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index 6390fefef..e16cf71e5 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -165,7 +165,7 @@
org.springdoc
- springdoc-openapi-javadoc
+ springdoc-openapi-ui
${springdoc.version}
diff --git a/yudao-framework/yudao-common/pom.xml b/yudao-framework/yudao-common/pom.xml
index 699fa9528..d46e4c7d6 100644
--- a/yudao-framework/yudao-common/pom.xml
+++ b/yudao-framework/yudao-common/pom.xml
@@ -63,11 +63,6 @@
springdoc-openapi-webmvc-core
-
- org.springdoc
- springdoc-openapi-javadoc
-
-
org.apache.skywalking
diff --git a/yudao-framework/yudao-spring-boot-starter-web/pom.xml b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
index 437503a40..9c820e956 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
@@ -40,7 +40,7 @@
org.springdoc
- springdoc-openapi-javadoc
+ springdoc-openapi-ui
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
index 01fcb6ed2..acdc21467 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
@@ -1,7 +1,6 @@
package cn.iocoder.yudao.framework.swagger.config;
import io.swagger.v3.oas.models.Components;
-import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
@@ -15,6 +14,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpHeaders;
+import java.util.Arrays;
+
/**
* Swagger3 自动配置类
*
@@ -29,15 +30,30 @@ public class YudaoSwaggerAutoConfiguration {
@Bean
public OpenAPI createRestApi(SwaggerProperties properties) {
- return new OpenAPI()
- .info(new Info().title(properties.getTitle())
- .description(properties.getDescription())
- .version(properties.getVersion())
- .license(new License().name("MIT").url("https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE")))
- .externalDocs(new ExternalDocumentation()
- .description(properties.getDescription())
- .url("https://gitee.com/zhijiantianya/ruoyi-vue-pro"));
+ //信息
+ Info info = new Info()
+ .title(properties.getTitle())
+ .description(properties.getDescription())
+ .version(properties.getVersion())
+ .license(new License().name("MIT").url("https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE"));
+ //鉴权组件(随便起名的)
+ SecurityScheme securityScheme = new SecurityScheme()
+ .type(SecurityScheme.Type.OAUTH2)
+ .scheme("bearer")//固定写法
+ .bearerFormat("JWT")
+ .in(SecurityScheme.In.HEADER)
+ .name(HttpHeaders.AUTHORIZATION);
+ Components components = new Components()
+ .addSecuritySchemes("bearer", securityScheme);
+ //鉴权限制要求(随便起名的)
+ SecurityRequirement securityRequirement = new SecurityRequirement()
+ .addList("bearer", Arrays.asList("read", "write"));
+
+ return new OpenAPI()
+ .info(info)
+ .components(components)
+ .addSecurityItem(securityRequirement);
}
@Bean
@@ -56,5 +72,4 @@ public class YudaoSwaggerAutoConfiguration {
.build();
}
-
}