Commit 0ebba2eb8116e4da42753f0e2c732e137baade9a
1 parent
3d390d0d
移除springfox配置
Showing
2 changed files
with
2 additions
and
47 deletions
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
| @@ -15,7 +15,6 @@ import org.springdoc.core.customizers.ServerBaseUrlCustomizer; | @@ -15,7 +15,6 @@ import org.springdoc.core.customizers.ServerBaseUrlCustomizer; | ||
| 15 | import org.springdoc.core.providers.JavadocProvider; | 15 | import org.springdoc.core.providers.JavadocProvider; |
| 16 | import org.springframework.boot.autoconfigure.AutoConfiguration; | 16 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 17 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | 17 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| 18 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| 19 | import org.springframework.boot.context.properties.EnableConfigurationProperties; | 18 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 20 | import org.springframework.context.annotation.Bean; | 19 | import org.springframework.context.annotation.Bean; |
| 21 | import org.springframework.http.HttpHeaders; | 20 | import org.springframework.http.HttpHeaders; |
| @@ -26,14 +25,13 @@ import java.util.Optional; | @@ -26,14 +25,13 @@ import java.util.Optional; | ||
| 26 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; | 25 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; |
| 27 | 26 | ||
| 28 | /** | 27 | /** |
| 29 | - * Swagger3 自动配置类 | 28 | + * springdoc 自动配置类 |
| 29 | + * 使用 knife4j.enable=false 禁用 Swagger | ||
| 30 | * | 30 | * |
| 31 | * @author 芋道源码 | 31 | * @author 芋道源码 |
| 32 | */ | 32 | */ |
| 33 | @AutoConfiguration | 33 | @AutoConfiguration |
| 34 | @ConditionalOnClass({OpenAPI.class}) | 34 | @ConditionalOnClass({OpenAPI.class}) |
| 35 | -// 允许使用 swagger.enable=false 禁用 Swagger | ||
| 36 | -@ConditionalOnProperty(prefix = "yudao.swagger", value = "enable", matchIfMissing = true) | ||
| 37 | @EnableConfigurationProperties(SwaggerProperties.class) | 35 | @EnableConfigurationProperties(SwaggerProperties.class) |
| 38 | public class YudaoSwaggerAutoConfiguration { | 36 | public class YudaoSwaggerAutoConfiguration { |
| 39 | 37 |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/core/SpringFoxHandlerProviderBeanPostProcessor.java deleted
| 1 | -//package cn.iocoder.yudao.framework.swagger.core; | ||
| 2 | -// | ||
| 3 | -//import cn.hutool.core.util.ReflectUtil; | ||
| 4 | -//import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 5 | -//import org.springframework.beans.BeansException; | ||
| 6 | -//import org.springframework.beans.factory.config.BeanPostProcessor; | ||
| 7 | -//import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping; | ||
| 8 | -//import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider; | ||
| 9 | -//import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; | ||
| 10 | -// | ||
| 11 | -//import java.util.List; | ||
| 12 | -// | ||
| 13 | -///** | ||
| 14 | -// * 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题 | ||
| 15 | -// * 该问题对应的 issue 为 https://github.com/springfox/springfox/issues/3462 | ||
| 16 | -// * | ||
| 17 | -// * @author 芋道源码 | ||
| 18 | -// */ | ||
| 19 | -//public class SpringFoxHandlerProviderBeanPostProcessor implements BeanPostProcessor { | ||
| 20 | -// | ||
| 21 | -// @Override | ||
| 22 | -// public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { | ||
| 23 | -// if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) { | ||
| 24 | -// customizeSpringfoxHandlerMappings(getHandlerMappings(bean)); | ||
| 25 | -// } | ||
| 26 | -// return bean; | ||
| 27 | -// } | ||
| 28 | -// | ||
| 29 | -// private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(List<T> mappings) { | ||
| 30 | -// // 移除,只保留 patternParser | ||
| 31 | -// List<T> copy = CollectionUtils.filterList(mappings, mapping -> mapping.getPatternParser() == null); | ||
| 32 | -// // 添加到 mappings 中 | ||
| 33 | -// mappings.clear(); | ||
| 34 | -// mappings.addAll(copy); | ||
| 35 | -// } | ||
| 36 | -// | ||
| 37 | -// @SuppressWarnings("unchecked") | ||
| 38 | -// private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) { | ||
| 39 | -// return (List<RequestMappingInfoHandlerMapping>) | ||
| 40 | -// ReflectUtil.getFieldValue(bean, "handlerMappings"); | ||
| 41 | -// } | ||
| 42 | -// | ||
| 43 | -//} |