mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 删除一些跟swagger有关的字眼 避免误解
This commit is contained in:
		@@ -197,8 +197,13 @@ mybatis-encryptor:
 | 
			
		||||
  publicKey:
 | 
			
		||||
  privateKey:
 | 
			
		||||
 | 
			
		||||
# Swagger配置
 | 
			
		||||
swagger:
 | 
			
		||||
springdoc:
 | 
			
		||||
  api-docs:
 | 
			
		||||
    # 是否开启接口文档
 | 
			
		||||
    enabled: true
 | 
			
		||||
#  swagger-ui:
 | 
			
		||||
#    # 持久化认证数据
 | 
			
		||||
#    persistAuthorization: true
 | 
			
		||||
  info:
 | 
			
		||||
    # 标题
 | 
			
		||||
    title: '标题:${ruoyi.name}后台管理系统_接口文档'
 | 
			
		||||
@@ -218,14 +223,6 @@ swagger:
 | 
			
		||||
        type: APIKEY
 | 
			
		||||
        in: HEADER
 | 
			
		||||
        name: ${sa-token.token-name}
 | 
			
		||||
 | 
			
		||||
springdoc:
 | 
			
		||||
  api-docs:
 | 
			
		||||
    # 是否开启接口文档
 | 
			
		||||
    enabled: true
 | 
			
		||||
  swagger-ui:
 | 
			
		||||
    # 持久化认证数据
 | 
			
		||||
    persistAuthorization: true
 | 
			
		||||
  #这里定义了两个分组,可定义多个,也可以不定义
 | 
			
		||||
  group-configs:
 | 
			
		||||
    - group: 1.演示模块
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
package com.ruoyi.framework.config;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.framework.config.properties.SwaggerProperties;
 | 
			
		||||
import com.ruoyi.framework.config.properties.SpringDocProperties;
 | 
			
		||||
import com.ruoyi.framework.handler.OpenApiHandler;
 | 
			
		||||
import io.swagger.v3.oas.models.OpenAPI;
 | 
			
		||||
import io.swagger.v3.oas.models.Paths;
 | 
			
		||||
@@ -34,25 +34,24 @@ import java.util.Set;
 | 
			
		||||
@Configuration
 | 
			
		||||
@AutoConfigureBefore(SpringDocConfiguration.class)
 | 
			
		||||
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
 | 
			
		||||
public class SwaggerConfig {
 | 
			
		||||
public class SpringDocConfig {
 | 
			
		||||
 | 
			
		||||
    private final SwaggerProperties swaggerProperties;
 | 
			
		||||
    private final ServerProperties serverProperties;
 | 
			
		||||
 | 
			
		||||
    @Bean
 | 
			
		||||
    @ConditionalOnMissingBean(OpenAPI.class)
 | 
			
		||||
    public OpenAPI openApi() {
 | 
			
		||||
    public OpenAPI openApi(SpringDocProperties properties) {
 | 
			
		||||
        OpenAPI openApi = new OpenAPI();
 | 
			
		||||
        // 文档基本信息
 | 
			
		||||
        SwaggerProperties.InfoProperties infoProperties = swaggerProperties.getInfo();
 | 
			
		||||
        SpringDocProperties.InfoProperties infoProperties = properties.getInfo();
 | 
			
		||||
        Info info = convertInfo(infoProperties);
 | 
			
		||||
        openApi.info(info);
 | 
			
		||||
        // 扩展文档信息
 | 
			
		||||
        openApi.externalDocs(swaggerProperties.getExternalDocs());
 | 
			
		||||
        openApi.tags(swaggerProperties.getTags());
 | 
			
		||||
        openApi.paths(swaggerProperties.getPaths());
 | 
			
		||||
        openApi.components(swaggerProperties.getComponents());
 | 
			
		||||
        Set<String> keySet = swaggerProperties.getComponents().getSecuritySchemes().keySet();
 | 
			
		||||
        openApi.externalDocs(properties.getExternalDocs());
 | 
			
		||||
        openApi.tags(properties.getTags());
 | 
			
		||||
        openApi.paths(properties.getPaths());
 | 
			
		||||
        openApi.components(properties.getComponents());
 | 
			
		||||
        Set<String> keySet = properties.getComponents().getSecuritySchemes().keySet();
 | 
			
		||||
        List<SecurityRequirement> list = new ArrayList<>();
 | 
			
		||||
        SecurityRequirement securityRequirement = new SecurityRequirement();
 | 
			
		||||
        keySet.forEach(securityRequirement::addList);
 | 
			
		||||
@@ -62,7 +61,7 @@ public class SwaggerConfig {
 | 
			
		||||
        return openApi;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Info convertInfo(SwaggerProperties.InfoProperties infoProperties) {
 | 
			
		||||
    private Info convertInfo(SpringDocProperties.InfoProperties infoProperties) {
 | 
			
		||||
        Info info = new Info();
 | 
			
		||||
        info.setTitle(infoProperties.getTitle());
 | 
			
		||||
        info.setDescription(infoProperties.getDescription());
 | 
			
		||||
@@ -20,8 +20,8 @@ import java.util.List;
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@Component
 | 
			
		||||
@ConfigurationProperties(prefix = "swagger")
 | 
			
		||||
public class SwaggerProperties {
 | 
			
		||||
@ConfigurationProperties(prefix = "springdoc")
 | 
			
		||||
public class SpringDocProperties {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 文档基本信息
 | 
			
		||||
		Reference in New Issue
	
	Block a user