diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index 5d5f497..cf6a508 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-boot/src/main/resources/bootstrap.yml b/blade-core-boot/src/main/resources/bootstrap.yml index 1fbd7e4..03797f2 100644 --- a/blade-core-boot/src/main/resources/bootstrap.yml +++ b/blade-core-boot/src/main/resources/bootstrap.yml @@ -101,7 +101,7 @@ mybatis-plus: swagger: title: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统 - version: 3.2.0 + version: 3.3.0 license: Powered By SpringBlade licenseUrl: https://bladex.vip terms-of-service-url: https://bladex.vip diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index c22e16f..fc7d4f6 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/config/BladeCloudAutoConfiguration.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/config/BladeCloudAutoConfiguration.java index 9f17455..415fa46 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/config/BladeCloudAutoConfiguration.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/config/BladeCloudAutoConfiguration.java @@ -27,6 +27,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Scope; @@ -36,6 +37,7 @@ import org.springframework.context.annotation.Scope; * @author Chill */ @Configuration(proxyBeanMethods = false) +@Import(BladeSentinelFilterConfiguration.class) @AutoConfigureBefore(SentinelFeignAutoConfiguration.class) public class BladeCloudAutoConfiguration { diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/config/BladeSentinelFilterConfiguration.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/config/BladeSentinelFilterConfiguration.java new file mode 100644 index 0000000..c257c43 --- /dev/null +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/config/BladeSentinelFilterConfiguration.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springblade.core.cloud.config; + +import com.alibaba.cloud.sentinel.SentinelProperties; +import com.alibaba.csp.sentinel.adapter.spring.webmvc.SentinelWebInterceptor; +import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler; +import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.DefaultBlockExceptionHandler; +import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser; +import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.UrlCleaner; +import com.alibaba.csp.sentinel.adapter.spring.webmvc.config.SentinelWebMvcConfig; +import lombok.RequiredArgsConstructor; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.util.StringUtils; + +import java.util.Optional; + +/** + * 处理sentinel2021兼容问题 + * + * @author Chill + */ +@RequiredArgsConstructor +@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) +public class BladeSentinelFilterConfiguration { + + @Bean + public SentinelWebInterceptor sentinelWebInterceptor(SentinelWebMvcConfig sentinelWebMvcConfig) { + return new SentinelWebInterceptor(sentinelWebMvcConfig); + } + + @Bean + public SentinelWebMvcConfig sentinelWebMvcConfig(SentinelProperties properties, + Optional urlCleanerOptional, Optional blockExceptionHandlerOptional, + Optional requestOriginParserOptional) { + SentinelWebMvcConfig sentinelWebMvcConfig = new SentinelWebMvcConfig(); + sentinelWebMvcConfig.setHttpMethodSpecify(properties.getHttpMethodSpecify()); + sentinelWebMvcConfig.setWebContextUnify(properties.getWebContextUnify()); + + if (blockExceptionHandlerOptional.isPresent()) { + blockExceptionHandlerOptional.ifPresent(sentinelWebMvcConfig::setBlockExceptionHandler); + } else { + if (StringUtils.hasText(properties.getBlockPage())) { + sentinelWebMvcConfig.setBlockExceptionHandler( + ((request, response, e) -> response.sendRedirect(properties.getBlockPage()))); + } else { + sentinelWebMvcConfig.setBlockExceptionHandler(new DefaultBlockExceptionHandler()); + } + } + + urlCleanerOptional.ifPresent(sentinelWebMvcConfig::setUrlCleaner); + requestOriginParserOptional.ifPresent(sentinelWebMvcConfig::setOriginParser); + return sentinelWebMvcConfig; + } + +} diff --git a/blade-core-datascope/pom.xml b/blade-core-datascope/pom.xml index 79524fc..473b9c2 100644 --- a/blade-core-datascope/pom.xml +++ b/blade-core-datascope/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-develop/pom.xml b/blade-core-develop/pom.xml index 1354111..fe35caf 100644 --- a/blade-core-develop/pom.xml +++ b/blade-core-develop/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index 5fbb75c..07786cd 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java index 0589676..15ac6b3 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java @@ -25,7 +25,7 @@ public interface AppConstant { /** * 应用版本 */ - String APPLICATION_VERSION = "3.2.0"; + String APPLICATION_VERSION = "3.3.0"; /** * 基础包 diff --git a/blade-core-log/pom.xml b/blade-core-log/pom.xml index 8f40f57..f5b12b9 100644 --- a/blade-core-log/pom.xml +++ b/blade-core-log/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-mybatis/pom.xml b/blade-core-mybatis/pom.xml index a327edc..9ffc3d1 100644 --- a/blade-core-mybatis/pom.xml +++ b/blade-core-mybatis/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-oss/pom.xml b/blade-core-oss/pom.xml index 70e2a34..47f0c8d 100644 --- a/blade-core-oss/pom.xml +++ b/blade-core-oss/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-report/pom.xml b/blade-core-report/pom.xml index 41bbd51..fd44f0c 100644 --- a/blade-core-report/pom.xml +++ b/blade-core-report/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-secure/pom.xml b/blade-core-secure/pom.xml index c065563..2a4d50d 100644 --- a/blade-core-secure/pom.xml +++ b/blade-core-secure/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-social/pom.xml b/blade-core-social/pom.xml index 611fdee..aaecaeb 100644 --- a/blade-core-social/pom.xml +++ b/blade-core-social/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-swagger/pom.xml b/blade-core-swagger/pom.xml index aacf5ca..e741d2f 100644 --- a/blade-core-swagger/pom.xml +++ b/blade-core-swagger/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 @@ -28,6 +28,11 @@ knife4j-micro-spring-boot-starter ${knife4j.version} + + com.google.guava + guava + ${guava.version} + diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerHandlerConfiguration.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerHandlerConfiguration.java new file mode 100644 index 0000000..c08c6e5 --- /dev/null +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerHandlerConfiguration.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2018-2028, lengleng (wangiegie@gmail.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springblade.core.swagger; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.util.ReflectionUtils; +import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping; +import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; + +import java.lang.reflect.Field; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 解决swagger2与最新版springboot冲突的问题 + * + * @author Chill + */ +@Configuration(proxyBeanMethods = false) +public class SwaggerHandlerConfiguration { + + @Bean + public static BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() { + return new BeanPostProcessor() { + + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + if (bean instanceof WebMvcRequestHandlerProvider) { + customizeSpringfoxHandlerMappings(getHandlerMappings(bean)); + } + return bean; + } + + private void customizeSpringfoxHandlerMappings(List mappings) { + List copy = mappings.stream() + .filter(mapping -> mapping.getPatternParser() == null) + .collect(Collectors.toList()); + mappings.clear(); + mappings.addAll(copy); + } + }; + } + + private static List getHandlerMappings(Object bean) { + try { + Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings"); + field.setAccessible(true); + return (List) field.get(bean); + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new IllegalStateException(e); + } + } + +} diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java index 82e5bb2..3d732f7 100644 --- a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java @@ -35,6 +35,7 @@ public class SwaggerLauncherServiceImpl implements LauncherService { props.setProperty("knife4j.production", "true"); } props.setProperty("knife4j.enable", "true"); + props.setProperty("spring.mvc.pathmatch.matching-strategy", "ANT_PATH_MATCHER"); } @Override diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java index 44862b7..a044f69 100644 --- a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerProperties.java @@ -55,7 +55,7 @@ public class SwaggerProperties { /** * 版本 **/ - private String version = "3.2.0"; + private String version = "3.3.0"; /** * 许可证 **/ diff --git a/blade-core-test/pom.xml b/blade-core-test/pom.xml index 39325c9..0d1f2b8 100644 --- a/blade-core-test/pom.xml +++ b/blade-core-test/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 3.2.0 + 3.3.0 4.0.0 diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index 34dd8be..2041de6 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-tool - 3.2.0 + 3.3.0 4.0.0 @@ -31,7 +31,7 @@ com.google.guava guava - 30.0-jre + ${guava.version} diff --git a/blade-core-transaction/pom.xml b/blade-core-transaction/pom.xml index 34a6853..c864df8 100644 --- a/blade-core-transaction/pom.xml +++ b/blade-core-transaction/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 3.2.0 + 3.3.0 4.0.0 diff --git a/pom.xml b/pom.xml index f530163..c1a83b5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 3.2.0 + 3.3.0 pom blade-tool @@ -36,7 +36,7 @@ - 3.2.0 + 3.3.0 1.8 3.8.1 @@ -47,15 +47,16 @@ 3.4.1 1.6.0 3.4.2 - 2.5.3 + 20.0 + 2.6.2 1.2.5 2021.1 - 2.0.3 + 2.0.4 1.4.2 2.0.0.RELEASE - 2.5.6 - 2020.0.4 + 2.6.3 + 2021.0.1 Cairo-SR8 UTF-8