🎉 3.4.0.RELEASE 升级适配springboot2.7.1 新增灰度服务功能

This commit is contained in:
smallchill 2022-07-12 01:58:20 +08:00
parent f48954ddec
commit 76f0ea534e
63 changed files with 535 additions and 134 deletions

View File

@ -1,7 +1,7 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/license-LGPL%20v3-blue.svg" alt="Build Status"> <img src="https://img.shields.io/badge/license-LGPL%20v3-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-2021-blue.svg" alt="Coverage Status"> <img src="https://img.shields.io/badge/Spring%20Cloud-2021-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.6.3-blue.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Spring%20Boot-2.7.1-blue.svg" alt="Downloads">
</p> </p>
## SpringBlade微服务开发平台 ## SpringBlade微服务开发平台
@ -25,19 +25,23 @@
blade-tool blade-tool
├── blade-core-boot -- 业务包综合模块 ├── blade-core-boot -- 业务包综合模块
├── blade-core-cloud -- cloud封装模块 ├── blade-core-cloud -- cloud封装模块
├── blade-core-datascope -- 数据权限封装模块
├── blade-core-develop -- 代码生成封装模块 ├── blade-core-develop -- 代码生成封装模块
├── blade-core-launch -- 基础启动模块 ├── blade-core-launch -- 基础启动模块
├── blade-core-loadbalancer -- 灰度服务封装模块
├── blade-core-log -- 日志封装模块 ├── blade-core-log -- 日志封装模块
├── blade-core-mybatis -- mybatis拓展封装模块 ├── blade-core-mybatis -- mybatis拓展封装模块
├── blade-core-oss -- 对象存储封装模块 ├── blade-core-oss -- 对象存储封装模块
├── blade-core-secure -- 安全模块 ├── blade-core-report -- 报表封装模块
├── blade-core-secure -- 安全封装模块
├── blade-core-social -- 第三方登录封装模块
├── blade-core-swagger -- swagger拓展封装模块 ├── blade-core-swagger -- swagger拓展封装模块
├── blade-core-test -- 单元测试封装模块 ├── blade-core-test -- 单元测试封装模块
├── blade-core-tool -- 单元测试封装模块 ├── blade-core-tool -- 单元测试封装模块
└── blade-core-transaction -- 分布式事物封装模块 └── blade-core-transaction -- 分布式事物封装模块
``` ```
## 官 ## 官方信息
* 官网地址:[https://bladex.vip](https://bladex.vip) * 官网地址:[https://bladex.vip](https://bladex.vip)
* 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip) * 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip)
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) * 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
@ -46,23 +50,28 @@ blade-tool
* 交流三群:`784729540`(满) * 交流三群:`784729540`(满)
* 交流四群:`1034621754`(满) * 交流四群:`1034621754`(满)
* 交流五群:`946350912`(满) * 交流五群:`946350912`(满)
* 交流六群: `511624269` * 交流六群:`511624269`(满)
* 交流七群:`298061704`
## 在线演示 ## 在线演示
* Sword演示地址[https://sword.bladex.vip](https://sword.bladex.vip) * Saber-基于Vue[https://saber.bladex.vip](https://saber.bladex.vip)
* Saber演示地址[https://saber.bladex.vip](https://saber.bladex.vip) * Sword-基于React[https://sword.bladex.vip](https://sword.bladex.vip)
* 数据大屏演示地址:[https://data.avuejs.com](https://data.avuejs.com)
## 数据大屏
* Caster-数据大屏展示系统:[https://caster.bladex.vip](https://caster.bladex.vip)
## 技术文档
* [SpringBlade开发手册一览](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册)
* [SpringBlade常见问题集锦](https://sns.bladex.vip/article-14966.html)
* [SpringBlade基于Kuboard部署K8S](https://kuboard.cn/learning/k8s-practice/spring-blade/)
## 项目地址 ## 项目地址
* 核心框架项目地址:[https://gitee.com/smallc/blade-tool](https://gitee.com/smallc/blade-tool)
* 后端Gitee地址[https://gitee.com/smallc/SpringBlade](https://gitee.com/smallc/SpringBlade) * 后端Gitee地址[https://gitee.com/smallc/SpringBlade](https://gitee.com/smallc/SpringBlade)
* 后端Github地址[https://github.com/chillzhuang/SpringBlade](https://github.com/chillzhuang/SpringBlade) * 后端Github地址[https://github.com/chillzhuang/SpringBlade](https://github.com/chillzhuang/SpringBlade)
* 后端SpringBoot版[https://gitee.com/smallc/SpringBlade/tree/boot/](https://gitee.com/smallc/SpringBlade/tree/boot/) * 后端SpringBoot版[https://gitee.com/smallc/SpringBlade/tree/boot/](https://gitee.com/smallc/SpringBlade/tree/boot/)
* 前端框架Sword(基于React)[https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword) * 前端框架Sword(基于React)[https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword)
* 前端框架Saber(基于Vue)[https://gitee.com/smallc/Saber](https://gitee.com/smallc/Saber) * 前端框架Saber(基于Vue)[https://gitee.com/smallc/Saber](https://gitee.com/smallc/Saber)
* 核心框架项目地址:[https://github.com/chillzhuang/blade-tool](https://github.com/chillzhuang/blade-tool)
## 技术文档
* [SpringBlade开发手册](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册)
## 开源协议 ## 开源协议
LGPL[GNU Lesser General Public License](http://www.gnu.org/licenses/lgpl.html) LGPL[GNU Lesser General Public License](http://www.gnu.org/licenses/lgpl.html)

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -88,13 +88,13 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId> <artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.22</version> <version>1.2.11</version>
</dependency> </dependency>
<!-- MySQL --> <!-- MySQL -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version> <version>8.0.22</version>
</dependency> </dependency>
<!-- PostgreSql --> <!-- PostgreSql -->
<!--<dependency> <!--<dependency>

View File

@ -19,9 +19,9 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.launch.props.BladeProperties; import org.springblade.core.launch.props.BladeProperties;
import org.springblade.core.tool.constant.SystemConstant; import org.springblade.core.tool.constant.SystemConstant;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.EnableAspectJAutoProxy;
/** /**
@ -30,7 +30,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
* @author Chill * @author Chill
*/ */
@Slf4j @Slf4j
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@EnableConfigurationProperties({ @EnableConfigurationProperties({
BladeProperties.class BladeProperties.class
}) })

View File

@ -17,8 +17,8 @@ package org.springblade.core.boot.config;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.resolver.TokenArgumentResolver; import org.springblade.core.boot.resolver.TokenArgumentResolver;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
@ -31,7 +31,7 @@ import java.util.List;
* @author Chill * @author Chill
*/ */
@Slf4j @Slf4j
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@EnableCaching @EnableCaching
@Order(Ordered.HIGHEST_PRECEDENCE) @Order(Ordered.HIGHEST_PRECEDENCE)
public class BladeWebMvcConfiguration implements WebMvcConfigurer { public class BladeWebMvcConfiguration implements WebMvcConfigurer {

View File

@ -16,9 +16,9 @@
package org.springblade.core.boot.config; package org.springblade.core.boot.config;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.retry.interceptor.RetryInterceptorBuilder; import org.springframework.retry.interceptor.RetryInterceptorBuilder;
import org.springframework.retry.interceptor.RetryOperationsInterceptor; import org.springframework.retry.interceptor.RetryOperationsInterceptor;
@ -28,7 +28,7 @@ import org.springframework.retry.interceptor.RetryOperationsInterceptor;
* @author Chill * @author Chill
*/ */
@Slf4j @Slf4j
@Configuration(proxyBeanMethods = false) @AutoConfiguration
public class RetryConfiguration { public class RetryConfiguration {
@Bean @Bean

View File

@ -11,7 +11,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.ClassUtil; import org.springblade.core.tool.utils.ClassUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.WebUtil; import org.springblade.core.tool.utils.WebUtil;
import org.springframework.context.annotation.Configuration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.core.io.InputStreamSource; import org.springframework.core.io.InputStreamSource;
@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
*/ */
@Slf4j @Slf4j
@Aspect @Aspect
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@Profile({AppConstant.DEV_CODE, AppConstant.TEST_CODE}) @Profile({AppConstant.DEV_CODE, AppConstant.TEST_CODE})
public class RequestLogAspect { public class RequestLogAspect {

View File

@ -19,11 +19,11 @@ import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.mp.config.MybatisPlusConfiguration; import org.springblade.core.mp.config.MybatisPlusConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
/** /**
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Primary;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@AutoConfigureBefore(MybatisPlusConfiguration.class) @AutoConfigureBefore(MybatisPlusConfiguration.class)
@EnableConfigurationProperties(BladeTenantProperties.class) @EnableConfigurationProperties(BladeTenantProperties.class)

View File

@ -101,7 +101,7 @@ mybatis-plus:
swagger: swagger:
title: SpringBlade 接口文档系统 title: SpringBlade 接口文档系统
description: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统
version: 3.3.1 version: 3.4.0
license: Powered By SpringBlade license: Powered By SpringBlade
licenseUrl: https://bladex.vip licenseUrl: https://bladex.vip
terms-of-service-url: https://bladex.vip terms-of-service-url: https://bladex.vip

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* --> * -->
<configuration scan="true" scanPeriod="60 seconds"> <configuration scan="false" debug="false">
<!-- 彩色日志依赖的渲染类 --> <!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* --> * -->
<configuration scan="true" scanPeriod="60 seconds"> <configuration scan="false" debug="false">
<!-- 彩色日志依赖的渲染类 --> <!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* --> * -->
<configuration scan="true" scanPeriod="60 seconds"> <configuration scan="false" debug="false">
<!-- 彩色日志依赖的渲染类 --> <!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -83,7 +83,7 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.75</version> <version>1.2.83_noneautotype</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -22,11 +22,11 @@ import feign.RequestInterceptor;
import org.springblade.core.cloud.feign.BladeFeignSentinel; import org.springblade.core.cloud.feign.BladeFeignSentinel;
import org.springblade.core.cloud.header.BladeFeignRequestHeaderInterceptor; import org.springblade.core.cloud.header.BladeFeignRequestHeaderInterceptor;
import org.springblade.core.cloud.sentinel.BladeBlockExceptionHandler; import org.springblade.core.cloud.sentinel.BladeBlockExceptionHandler;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
@ -36,7 +36,7 @@ import org.springframework.context.annotation.Scope;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@Import(BladeSentinelFilterConfiguration.class) @Import(BladeSentinelFilterConfiguration.class)
@AutoConfigureBefore(SentinelFeignAutoConfiguration.class) @AutoConfigureBefore(SentinelFeignAutoConfiguration.class)
public class BladeCloudAutoConfiguration { public class BladeCloudAutoConfiguration {

View File

@ -104,6 +104,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
public interface Logger { public interface Logger {
/** /**
* log * log
*
* @param message message * @param message message
*/ */
void log(String message); void log(String message);
@ -111,7 +112,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
/** /**
* A {@link Logger} defaults output appropriate for the current platform. * A {@link Logger} defaults output appropriate for the current platform.
*/ */
Logger DEFAULT = message -> Platform.get().log(INFO, message, null); Logger DEFAULT = message -> Platform.get().log(message, INFO, null);
} }
public HttpLoggingInterceptor() { public HttpLoggingInterceptor() {
@ -128,6 +129,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
/** /**
* Change the level at which this interceptor logs. * Change the level at which this interceptor logs.
*
* @param level log Level * @param level log Level
* @return HttpLoggingInterceptor * @return HttpLoggingInterceptor
*/ */
@ -300,6 +302,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
* of code points to detect unicode control characters commonly used in binary file signatures. * of code points to detect unicode control characters commonly used in binary file signatures.
*/ */
private static int plainCnt = 16; private static int plainCnt = 16;
private static boolean isPlaintext(Buffer buffer) { private static boolean isPlaintext(Buffer buffer) {
try { try {
Buffer prefix = new Buffer(); Buffer prefix = new Buffer();

View File

@ -22,6 +22,7 @@ import org.springblade.core.cloud.header.BladeFeignAccountGetter;
import org.springblade.core.cloud.props.BladeFeignHeadersProperties; import org.springblade.core.cloud.props.BladeFeignHeadersProperties;
import org.springblade.core.tool.utils.Charsets; import org.springblade.core.tool.utils.Charsets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
@ -30,7 +31,6 @@ import org.springframework.cloud.commons.httpclient.OkHttpClientConnectionPoolFa
import org.springframework.cloud.commons.httpclient.OkHttpClientFactory; import org.springframework.cloud.commons.httpclient.OkHttpClientFactory;
import org.springframework.cloud.openfeign.support.FeignHttpClientProperties; import org.springframework.cloud.openfeign.support.FeignHttpClientProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
@ -48,7 +48,7 @@ import java.util.concurrent.TimeUnit;
* *
* @author L.cm * @author L.cm
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@ConditionalOnClass(okhttp3.OkHttpClient.class) @ConditionalOnClass(okhttp3.OkHttpClient.class)
@EnableConfigurationProperties(BladeFeignHeadersProperties.class) @EnableConfigurationProperties(BladeFeignHeadersProperties.class)

View File

@ -15,10 +15,10 @@
*/ */
package org.springblade.core.cloud.version; package org.springblade.core.cloud.version;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations; import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/** /**
* url版本号处理 * url版本号处理
@ -27,7 +27,7 @@ import org.springframework.context.annotation.Configuration;
* *
* @author L.cm * @author L.cm
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@ConditionalOnWebApplication @ConditionalOnWebApplication
public class VersionMappingAutoConfiguration { public class VersionMappingAutoConfiguration {
@Bean @Bean

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -22,11 +22,11 @@ import org.springblade.core.datascope.handler.DataScopeHandler;
import org.springblade.core.datascope.handler.ScopeModelHandler; import org.springblade.core.datascope.handler.ScopeModelHandler;
import org.springblade.core.datascope.interceptor.DataScopeInterceptor; import org.springblade.core.datascope.interceptor.DataScopeInterceptor;
import org.springblade.core.datascope.props.DataScopeProperties; import org.springblade.core.datascope.props.DataScopeProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
/** /**
@ -34,7 +34,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@EnableConfigurationProperties(DataScopeProperties.class) @EnableConfigurationProperties(DataScopeProperties.class)
public class DataScopeConfiguration { public class DataScopeConfiguration {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -20,12 +20,14 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.generator.FastAutoGenerator; import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile; import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.config.TemplateType; import com.baomidou.mybatisplus.generator.config.TemplateType;
import com.baomidou.mybatisplus.generator.config.builder.CustomFile;
import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.DateType; import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine; import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Mapper;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.develop.constant.DevelopConstant; import org.springblade.develop.constant.DevelopConstant;
@ -36,6 +38,7 @@ import org.springframework.core.io.support.PropertiesLoaderUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -91,6 +94,10 @@ public class BladeCodeGenerator {
* 是否包含包装器 * 是否包含包装器
*/ */
private Boolean hasWrapper = Boolean.TRUE; private Boolean hasWrapper = Boolean.TRUE;
/**
* 是否包含服务名
*/
private Boolean hasServiceName = Boolean.FALSE;
/** /**
* 基础业务字段 * 基础业务字段
*/ */
@ -159,10 +166,10 @@ public class BladeCodeGenerator {
.globalConfig(builder -> builder.author(props.getProperty("author")).dateType(DateType.TIME_PACK).enableSwagger().outputDir(getOutputDir()).disableOpenDir()) .globalConfig(builder -> builder.author(props.getProperty("author")).dateType(DateType.TIME_PACK).enableSwagger().outputDir(getOutputDir()).disableOpenDir())
.packageConfig(builder -> builder.parent(packageName).controller("controller").entity("entity").service("service").serviceImpl("service.impl").mapper("mapper").xml("mapper")) .packageConfig(builder -> builder.parent(packageName).controller("controller").entity("entity").service("service").serviceImpl("service.impl").mapper("mapper").xml("mapper"))
.strategyConfig(builder -> builder.addTablePrefix(tablePrefix).addInclude(includeTables).addExclude(excludeTables) .strategyConfig(builder -> builder.addTablePrefix(tablePrefix).addInclude(includeTables).addExclude(excludeTables)
.entityBuilder().naming(NamingStrategy.underline_to_camel).columnNaming(NamingStrategy.underline_to_camel).enableLombok().superClass("org.springblade.core.mp.base.BaseEntity").addSuperEntityColumns(superEntityColumns) .entityBuilder().naming(NamingStrategy.underline_to_camel).columnNaming(NamingStrategy.underline_to_camel).enableLombok().superClass("org.springblade.core.mp.base.BaseEntity").addSuperEntityColumns(superEntityColumns).enableFileOverride()
.serviceBuilder().superServiceClass("org.springblade.core.mp.base.BaseService").superServiceImplClass("org.springblade.core.mp.base.BaseServiceImpl").formatServiceFileName("I%sService").formatServiceImplFileName("%sServiceImpl") .serviceBuilder().superServiceClass("org.springblade.core.mp.base.BaseService").superServiceImplClass("org.springblade.core.mp.base.BaseServiceImpl").formatServiceFileName("I%sService").formatServiceImplFileName("%sServiceImpl").enableFileOverride()
.mapperBuilder().enableMapperAnnotation().enableBaseResultMap().enableBaseColumnList().formatMapperFileName("%sMapper").formatXmlFileName("%sMapper") .mapperBuilder().mapperAnnotation(Mapper.class).enableBaseResultMap().enableBaseColumnList().formatMapperFileName("%sMapper").formatXmlFileName("%sMapper").enableFileOverride()
.controllerBuilder().superClass("org.springblade.core.boot.ctrl.BladeController").formatFileName("%sController").enableRestStyle().enableHyphenStyle() .controllerBuilder().superClass("org.springblade.core.boot.ctrl.BladeController").formatFileName("%sController").enableRestStyle().enableHyphenStyle().enableFileOverride()
) )
.templateConfig(builder -> builder.disable(TemplateType.ENTITY) .templateConfig(builder -> builder.disable(TemplateType.ENTITY)
.entity("/templates/entity.java.vm") .entity("/templates/entity.java.vm")
@ -177,14 +184,16 @@ public class BladeCodeGenerator {
) )
.templateEngine(new VelocityTemplateEngine() { .templateEngine(new VelocityTemplateEngine() {
@Override @Override
protected void outputCustomFile(Map<String, String> customFile, TableInfo tableInfo, Map<String, Object> objectMap) { protected void outputCustomFile(List<CustomFile> customFiles, TableInfo tableInfo, Map<String, Object> objectMap) {
String entityName = tableInfo.getEntityName(); String entityName = tableInfo.getEntityName();
String entityNameLower = tableInfo.getEntityName().toLowerCase(); String entityNameLower = tableInfo.getEntityName().toLowerCase();
customFile.forEach((key, value) -> { customFiles.forEach(customFile -> {
String outputPath = getPathInfo(OutputFile.other); String key = customFile.getFileName();
if (StringUtil.equals(key, "menu.sql")) { String value = customFile.getTemplatePath();
String outputPath = getPathInfo(OutputFile.parent);
objectMap.put("entityKey", entityNameLower); objectMap.put("entityKey", entityNameLower);
if (StringUtil.equals(key, "menu.sql")) {
objectMap.put("menuId", IdWorker.getId()); objectMap.put("menuId", IdWorker.getId());
objectMap.put("addMenuId", IdWorker.getId()); objectMap.put("addMenuId", IdWorker.getId());
objectMap.put("editMenuId", IdWorker.getId()); objectMap.put("editMenuId", IdWorker.getId());

View File

@ -53,7 +53,7 @@ import $!{superControllerClassPackage};
*/ */
@RestController @RestController
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("#if($!{package.ModuleName})$!{package.ModuleName}#end/$!{entityKey}") @RequestMapping("#if($!{hasServiceName})/$!{serviceName}#end/$!{entityKey}")
@Api(value = "$!{table.comment}", tags = "$!{table.comment}接口") @Api(value = "$!{table.comment}", tags = "$!{table.comment}接口")
#if($!{superControllerClass}) #if($!{superControllerClass})
public class $!{table.controllerName} extends $!{superControllerClass} { public class $!{table.controllerName} extends $!{superControllerClass} {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -16,8 +16,8 @@
package org.springblade.core.launch; package org.springblade.core.launch;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.web.context.WebServerInitializedEvent; import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
@ -30,7 +30,7 @@ import org.springframework.util.StringUtils;
* @author Chill * @author Chill
*/ */
@Slf4j @Slf4j
@Configuration(proxyBeanMethods = false) @AutoConfiguration
public class StartEventListener { public class StartEventListener {
@Async @Async

View File

@ -17,8 +17,8 @@ package org.springblade.core.launch.config;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.launch.props.BladeProperties; import org.springblade.core.launch.props.BladeProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
@ -27,7 +27,7 @@ import org.springframework.core.annotation.Order;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@Order(Ordered.HIGHEST_PRECEDENCE) @Order(Ordered.HIGHEST_PRECEDENCE)
@EnableConfigurationProperties({ @EnableConfigurationProperties({

View File

@ -25,7 +25,7 @@ public interface AppConstant {
/** /**
* 应用版本 * 应用版本
*/ */
String APPLICATION_VERSION = "3.3.1"; String APPLICATION_VERSION = "3.4.0";
/** /**
* 基础包 * 基础包

View File

@ -19,8 +19,8 @@ import lombok.Getter;
import org.springblade.core.launch.utils.INetUtil; import org.springblade.core.launch.utils.INetUtil;
import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.context.annotation.Configuration;
/** /**
* 服务器信息 * 服务器信息
@ -28,7 +28,7 @@ import org.springframework.context.annotation.Configuration;
* @author Chill * @author Chill
*/ */
@Getter @Getter
@Configuration(proxyBeanMethods = false) @AutoConfiguration
public class ServerInfo implements SmartInitializingSingleton { public class ServerInfo implements SmartInitializingSingleton {
private final ServerProperties serverProperties; private final ServerProperties serverProperties;
private String hostName; private String hostName;

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId>
<version>3.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blade-core-loadbalancer</artifactId>
<name>${project.artifactId}</name>
<version>${blade.tool.version}</version>
<packaging>jar</packaging>
<dependencies>
<!-- LoadBalancer -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- Feign -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
</exclusion>
</exclusions>
<version>${alibaba.cloud.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<exclusions>
<exclusion>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
</exclusion>
</exclusions>
<version>${alibaba.cloud.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${alibaba.nacos.version}</version>
</dependency>
<!-- Web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<!-- WebFlux -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,61 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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.loadbalancer.config;
import org.springblade.core.loadbalancer.props.BladeLoadBalancerProperties;
import org.springblade.core.loadbalancer.rule.GrayscaleLoadBalancer;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientConfiguration;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientSpecification;
import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
/**
* blade 负载均衡策略
*
* @author Chill
*/
@AutoConfiguration
@AutoConfigureBefore(LoadBalancerClientConfiguration.class)
@EnableConfigurationProperties(BladeLoadBalancerProperties.class)
@ConditionalOnProperty(value = BladeLoadBalancerProperties.PROPERTIES_PREFIX + ".enabled", matchIfMissing = true)
@Order(BladeLoadBalancerConfiguration.REACTIVE_SERVICE_INSTANCE_SUPPLIER_ORDER)
public class BladeLoadBalancerConfiguration {
public static final int REACTIVE_SERVICE_INSTANCE_SUPPLIER_ORDER = 193827465;
@Bean
public ReactorLoadBalancer<ServiceInstance> reactorServiceInstanceLoadBalancer(Environment environment,
LoadBalancerClientFactory loadBalancerClientFactory,
BladeLoadBalancerProperties bladeLoadBalancerProperties) {
String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME);
return new GrayscaleLoadBalancer(loadBalancerClientFactory.getLazyProvider(name, ServiceInstanceListSupplier.class), bladeLoadBalancerProperties);
}
@Bean
public LoadBalancerClientSpecification loadBalancerClientSpecification() {
return new LoadBalancerClientSpecification("default.bladeLoadBalancerConfiguration",
new Class[]{BladeLoadBalancerConfiguration.class});
}
}

View File

@ -0,0 +1,30 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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.loadbalancer.constant;
/**
* LoadBalancer 常量
*
* @author Chill
*/
public interface LoadBalancerConstant {
/**
* 灰度服务的请求头参数
*/
String VERSION_NAME = "version";
}

View File

@ -0,0 +1,51 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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.loadbalancer.props;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import java.util.ArrayList;
import java.util.List;
/**
* LoadBalancer 配置
*
* @author Chill
*/
@Getter
@Setter
@RefreshScope
@ConfigurationProperties(BladeLoadBalancerProperties.PROPERTIES_PREFIX)
public class BladeLoadBalancerProperties {
public static final String PROPERTIES_PREFIX = "blade.loadbalancer";
/**
* 是否开启自定义负载均衡
*/
private boolean enabled = true;
/**
* 灰度服务版本
*/
private String version;
/**
* 优先的ip列表支持通配符例如10.20.0.8*10.20.0.*
*/
private List<String> priorIpPattern = new ArrayList<>();
}

View File

@ -0,0 +1,49 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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.loadbalancer.rule;
import net.dreamlu.mica.auto.annotation.AutoEnvPostProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.util.StringUtils;
/**
* 灰度版本 自动处理
*
* @author Chill
*/
@AutoEnvPostProcessor
public class GrayscaleEnvPostProcessor implements EnvironmentPostProcessor, Ordered {
private static final String GREYSCALE_KEY = "blade.loadbalancer.version";
private static final String METADATA_KEY = "spring.cloud.nacos.discovery.metadata.version";
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
String version = environment.getProperty(GREYSCALE_KEY);
if (StringUtils.hasText(version)) {
environment.getSystemProperties().put(METADATA_KEY, version);
}
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
}

View File

@ -0,0 +1,114 @@
/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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.loadbalancer.rule;
import com.alibaba.nacos.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.loadbalancer.props.BladeLoadBalancerProperties;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.*;
import org.springframework.cloud.loadbalancer.core.NoopServiceInstanceListSupplier;
import org.springframework.cloud.loadbalancer.core.ReactorServiceInstanceLoadBalancer;
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
import org.springframework.http.HttpHeaders;
import org.springframework.util.CollectionUtils;
import org.springframework.util.PatternMatchUtils;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import static org.springblade.core.loadbalancer.constant.LoadBalancerConstant.VERSION_NAME;
/**
* LoadBalancer 负载规则
*
* @author Chill
*/
@Slf4j
@RequiredArgsConstructor
public class GrayscaleLoadBalancer implements ReactorServiceInstanceLoadBalancer {
private final ObjectProvider<ServiceInstanceListSupplier> serviceInstanceListSupplierProvider;
private final BladeLoadBalancerProperties bladeLoadBalancerProperties;
@Override
public Mono<Response<ServiceInstance>> choose(Request request) {
ServiceInstanceListSupplier supplier = serviceInstanceListSupplierProvider
.getIfAvailable(NoopServiceInstanceListSupplier::new);
return supplier.get(request).next()
.map(serviceInstances -> getInstanceResponse(serviceInstances, request));
}
/**
* 自定义节点规则返回目标节点
*/
private Response<ServiceInstance> getInstanceResponse(List<ServiceInstance> instances, Request request) {
// 注册中心无可用实例 返回空
if (CollectionUtils.isEmpty(instances)) {
return new EmptyResponse();
}
// 指定ip则返回满足ip的服务
List<String> priorIpPattern = bladeLoadBalancerProperties.getPriorIpPattern();
if (!priorIpPattern.isEmpty()) {
String[] priorIpPatterns = priorIpPattern.toArray(new String[0]);
List<ServiceInstance> priorIpInstances = instances.stream().filter(
(i -> PatternMatchUtils.simpleMatch(priorIpPatterns, i.getHost()))
).collect(Collectors.toList());
if (!priorIpInstances.isEmpty()) {
instances = priorIpInstances;
}
}
// 获取灰度版本号
DefaultRequestContext context = (DefaultRequestContext) request.getContext();
RequestData requestData = (RequestData) context.getClientRequest();
HttpHeaders headers = requestData.getHeaders();
String versionName = headers.getFirst(VERSION_NAME);
// 没有指定灰度版本则返回正式的服务
if (StringUtils.isBlank(versionName)) {
List<ServiceInstance> noneGrayscaleInstances = instances.stream().filter(
i -> !i.getMetadata().containsKey(VERSION_NAME)
).collect(Collectors.toList());
return randomInstance(noneGrayscaleInstances);
}
// 指定灰度版本则返回标记的服务
List<ServiceInstance> grayscaleInstances = instances.stream().filter(i -> {
String versionNameInMetadata = i.getMetadata().get(VERSION_NAME);
return StringUtils.equalsIgnoreCase(versionNameInMetadata, versionName);
}).collect(Collectors.toList());
return randomInstance(grayscaleInstances);
}
/**
* 采用随机规则返回
*/
private Response<ServiceInstance> randomInstance(List<ServiceInstance> instances) {
// 若没有可用节点则返回空
if (instances.isEmpty()) {
return new EmptyResponse();
}
// 挑选随机节点返回
int randomIndex = ThreadLocalRandom.current().nextInt(instances.size());
ServiceInstance instance = instances.get(randomIndex % instances.size());
return new DefaultResponse(instance);
}
}

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -19,6 +19,7 @@ package org.springblade.core.log.config;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.log.error.BladeErrorAttributes; import org.springblade.core.log.error.BladeErrorAttributes;
import org.springblade.core.log.error.BladeErrorController; import org.springblade.core.log.error.BladeErrorController;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -31,7 +32,6 @@ import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
import javax.servlet.Servlet; import javax.servlet.Servlet;
@ -41,7 +41,7 @@ import javax.servlet.Servlet;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@ConditionalOnWebApplication @ConditionalOnWebApplication
@AutoConfigureBefore(ErrorMvcAutoConfiguration.class) @AutoConfigureBefore(ErrorMvcAutoConfiguration.class)

View File

@ -17,24 +17,24 @@
package org.springblade.core.log.config; package org.springblade.core.log.config;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.log.aspect.ApiLogAspect;
import org.springblade.core.log.event.ApiLogListener;
import org.springblade.core.log.event.UsualLogListener;
import org.springblade.core.log.event.ErrorLogListener;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.launch.props.BladeProperties; import org.springblade.core.launch.props.BladeProperties;
import org.springblade.core.launch.server.ServerInfo; import org.springblade.core.launch.server.ServerInfo;
import org.springblade.core.log.aspect.ApiLogAspect;
import org.springblade.core.log.event.ApiLogListener;
import org.springblade.core.log.event.ErrorLogListener;
import org.springblade.core.log.event.UsualLogListener;
import org.springblade.core.log.feign.ILogClient; import org.springblade.core.log.feign.ILogClient;
import org.springblade.core.log.logger.BladeLogger;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/** /**
* 日志工具自动配置 * 日志工具自动配置
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@ConditionalOnWebApplication @ConditionalOnWebApplication
public class BladeLogToolAutoConfiguration { public class BladeLogToolAutoConfiguration {

View File

@ -25,9 +25,9 @@ import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.UrlUtil; import org.springblade.core.tool.utils.UrlUtil;
import org.springblade.core.tool.utils.WebUtil; import org.springblade.core.tool.utils.WebUtil;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.BindException; import org.springframework.validation.BindException;
@ -55,7 +55,7 @@ import java.util.Set;
* @author Chill * @author Chill
*/ */
@Slf4j @Slf4j
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@ConditionalOnClass({Servlet.class, DispatcherServlet.class}) @ConditionalOnClass({Servlet.class, DispatcherServlet.class})
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@RestControllerAdvice @RestControllerAdvice

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -31,11 +31,11 @@ import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotationAwareOrderComparator; import org.springframework.core.annotation.AnnotationAwareOrderComparator;
/** /**
@ -43,7 +43,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@MapperScan("org.springblade.**.mapper.**") @MapperScan("org.springblade.**.mapper.**")
@EnableConfigurationProperties(MybatisPlusProperties.class) @EnableConfigurationProperties(MybatisPlusProperties.class)

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -24,20 +24,20 @@ import org.springblade.core.oss.AliossTemplate;
import org.springblade.core.oss.props.OssProperties; import org.springblade.core.oss.props.OssProperties;
import org.springblade.core.oss.rule.BladeOssRule; import org.springblade.core.oss.rule.BladeOssRule;
import org.springblade.core.oss.rule.OssRule; import org.springblade.core.oss.rule.OssRule;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/** /**
* Alioss配置类 * Alioss配置类
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@AutoConfigureAfter(QiniuConfiguration.class) @AutoConfigureAfter(QiniuConfiguration.class)
@EnableConfigurationProperties(OssProperties.class) @EnableConfigurationProperties(OssProperties.class)

View File

@ -24,19 +24,19 @@ import org.springblade.core.oss.QiniuTemplate;
import org.springblade.core.oss.props.OssProperties; import org.springblade.core.oss.props.OssProperties;
import org.springblade.core.oss.rule.BladeOssRule; import org.springblade.core.oss.rule.BladeOssRule;
import org.springblade.core.oss.rule.OssRule; import org.springblade.core.oss.rule.OssRule;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/** /**
* Oss配置类 * Oss配置类
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@EnableConfigurationProperties(OssProperties.class) @EnableConfigurationProperties(OssProperties.class)
@ConditionalOnProperty(value = "oss.name", havingValue = "qiniu") @ConditionalOnProperty(value = "oss.name", havingValue = "qiniu")

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -23,12 +23,12 @@ import org.springblade.core.report.props.ReportProperties;
import org.springblade.core.report.provider.DatabaseProvider; import org.springblade.core.report.provider.DatabaseProvider;
import org.springblade.core.report.provider.ReportPlaceholderProvider; import org.springblade.core.report.provider.ReportPlaceholderProvider;
import org.springblade.core.report.service.IReportFileService; import org.springblade.core.report.service.IReportFileService;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.ImportResource;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
@ -40,7 +40,7 @@ import javax.servlet.Servlet;
* @author Chill * @author Chill
*/ */
@Order @Order
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@ConditionalOnProperty(value = "report.enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(value = "report.enabled", havingValue = "true", matchIfMissing = true)
@EnableConfigurationProperties({ReportProperties.class, ReportDatabaseProperties.class}) @EnableConfigurationProperties({ReportProperties.class, ReportDatabaseProperties.class})
@ImportResource("classpath:ureport-console-context.xml") @ImportResource("classpath:ureport-console-context.xml")

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -17,10 +17,10 @@ package org.springblade.core.secure.config;
import org.springblade.core.secure.registry.SecureRegistry; import org.springblade.core.secure.registry.SecureRegistry;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
/** /**
@ -29,7 +29,7 @@ import org.springframework.core.annotation.Order;
* @author Chill * @author Chill
*/ */
@Order @Order
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AutoConfigureBefore(SecureConfiguration.class) @AutoConfigureBefore(SecureConfiguration.class)
public class RegistryConfiguration { public class RegistryConfiguration {

View File

@ -24,10 +24,10 @@ import org.springblade.core.secure.props.BladeSecureProperties;
import org.springblade.core.secure.provider.ClientDetailsServiceImpl; import org.springblade.core.secure.provider.ClientDetailsServiceImpl;
import org.springblade.core.secure.provider.IClientDetailsService; import org.springblade.core.secure.provider.IClientDetailsService;
import org.springblade.core.secure.registry.SecureRegistry; import org.springblade.core.secure.registry.SecureRegistry;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@ -39,7 +39,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* @author Chill * @author Chill
*/ */
@Order @Order
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@EnableConfigurationProperties({BladeSecureProperties.class}) @EnableConfigurationProperties({BladeSecureProperties.class})
public class SecureConfiguration implements WebMvcConfigurer { public class SecureConfiguration implements WebMvcConfigurer {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -19,17 +19,17 @@ import com.xkcoding.http.HttpUtil;
import com.xkcoding.http.support.Http; import com.xkcoding.http.support.Http;
import com.xkcoding.http.support.httpclient.HttpClientImpl; import com.xkcoding.http.support.httpclient.HttpClientImpl;
import org.springblade.core.social.props.SocialProperties; import org.springblade.core.social.props.SocialProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/** /**
* SocialConfiguration * SocialConfiguration
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@EnableConfigurationProperties(SocialProperties.class) @EnableConfigurationProperties(SocialProperties.class)
public class SocialConfiguration { public class SocialConfiguration {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -20,10 +20,10 @@ import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.launch.props.BladeProperties; import org.springblade.core.launch.props.BladeProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
@ -44,7 +44,7 @@ import java.util.List;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@EnableSwagger @EnableSwagger
@EnableConfigurationProperties(SwaggerProperties.class) @EnableConfigurationProperties(SwaggerProperties.class)
@Import(BeanValidatorPluginsConfiguration.class) @Import(BeanValidatorPluginsConfiguration.class)

View File

@ -17,8 +17,8 @@ package org.springblade.core.swagger;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping; import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
@ -32,7 +32,7 @@ import java.util.stream.Collectors;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
public class SwaggerHandlerConfiguration { public class SwaggerHandlerConfiguration {
@Bean @Bean

View File

@ -55,7 +55,7 @@ public class SwaggerProperties {
/** /**
* 版本 * 版本
**/ **/
private String version = "3.3.1"; private String version = "3.4.0";
/** /**
* 许可证 * 许可证
**/ **/

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -23,11 +23,11 @@ import com.fasterxml.jackson.databind.SerializationFeature;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.jackson.BladeJavaTimeModule; import org.springblade.core.tool.jackson.BladeJavaTimeModule;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
@ -41,7 +41,7 @@ import java.util.TimeZone;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@ConditionalOnClass(ObjectMapper.class) @ConditionalOnClass(ObjectMapper.class)
@AutoConfigureBefore(JacksonAutoConfiguration.class) @AutoConfigureBefore(JacksonAutoConfiguration.class)

View File

@ -20,7 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.jackson.MappingApiJackson2HttpMessageConverter; import org.springblade.core.tool.jackson.MappingApiJackson2HttpMessageConverter;
import org.springblade.core.tool.utils.Charsets; import org.springblade.core.tool.utils.Charsets;
import org.springframework.context.annotation.Configuration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.http.converter.*; import org.springframework.http.converter.*;
@ -34,7 +34,7 @@ import java.util.List;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@Order(Ordered.HIGHEST_PRECEDENCE) @Order(Ordered.HIGHEST_PRECEDENCE)
public class MessageConfiguration implements WebMvcConfigurer { public class MessageConfiguration implements WebMvcConfigurer {

View File

@ -17,6 +17,7 @@ package org.springblade.core.tool.config;
import org.springblade.core.tool.redis.RedisKeySerializer; import org.springblade.core.tool.redis.RedisKeySerializer;
import org.springblade.core.tool.utils.RedisUtil; import org.springblade.core.tool.utils.RedisUtil;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -24,7 +25,6 @@ import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.cache.RedisCacheWriter; import org.springframework.data.redis.cache.RedisCacheWriter;
@ -41,7 +41,7 @@ import java.time.Duration;
* @author Chill * @author Chill
*/ */
@EnableCaching @EnableCaching
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AutoConfigureBefore(RedisAutoConfiguration.class) @AutoConfigureBefore(RedisAutoConfiguration.class)
public class RedisTemplateConfiguration { public class RedisTemplateConfiguration {

View File

@ -19,10 +19,10 @@ import lombok.AllArgsConstructor;
import org.springblade.core.tool.request.BladeRequestFilter; import org.springblade.core.tool.request.BladeRequestFilter;
import org.springblade.core.tool.request.RequestProperties; import org.springblade.core.tool.request.RequestProperties;
import org.springblade.core.tool.request.XssProperties; import org.springblade.core.tool.request.XssProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import javax.servlet.DispatcherType; import javax.servlet.DispatcherType;
@ -32,7 +32,7 @@ import javax.servlet.DispatcherType;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@AllArgsConstructor @AllArgsConstructor
@EnableConfigurationProperties({RequestProperties.class, XssProperties.class}) @EnableConfigurationProperties({RequestProperties.class, XssProperties.class})
public class RequestConfiguration { public class RequestConfiguration {

View File

@ -17,8 +17,8 @@ package org.springblade.core.tool.config;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -28,7 +28,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
@Order(Ordered.HIGHEST_PRECEDENCE) @Order(Ordered.HIGHEST_PRECEDENCE)
public class ToolConfiguration implements WebMvcConfigurer { public class ToolConfiguration implements WebMvcConfigurer {

View File

@ -1,18 +1,17 @@
/* /**
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* * <p>
* Redistribution and use in source and binary forms, with or without * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* modification, are permitted provided that the following conditions are met: * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* Redistributions of source code must retain the above copyright notice, * <p>
* this list of conditions and the following disclaimer. * http://www.gnu.org/licenses/lgpl.html
* Redistributions in binary form must reproduce the above copyright * <p>
* notice, this list of conditions and the following disclaimer in the * Unless required by applicable law or agreed to in writing, software
* documentation and/or other materials provided with the distribution. * distributed under the License is distributed on an "AS IS" BASIS,
* Neither the name of the dreamlu.net developer nor the names of its * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* contributors may be used to endorse or promote products derived from * See the License for the specific language governing permissions and
* this software without specific prior written permission. * limitations under the License.
* Author: Chill 庄骞 (smallchill@163.com)
*/ */
package org.springblade.core.tool.utils; package org.springblade.core.tool.utils;

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<version>3.3.1</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -15,14 +15,14 @@
*/ */
package org.springblade.core.transaction.config; package org.springblade.core.transaction.config;
import org.springframework.context.annotation.Configuration; import org.springframework.boot.autoconfigure.AutoConfiguration;
/** /**
* 分布式事务数据源配置 * 分布式事务数据源配置
* *
* @author Chill * @author Chill
*/ */
@Configuration(proxyBeanMethods = false) @AutoConfiguration
public class DataSourceConfiguration { public class DataSourceConfiguration {
} }

19
pom.xml
View File

@ -5,7 +5,7 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-tool</artifactId> <artifactId>blade-tool</artifactId>
<version>3.3.1</version> <version>3.4.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>blade-tool</name> <name>blade-tool</name>
<description> <description>
@ -36,27 +36,27 @@
</scm> </scm>
<properties> <properties>
<blade.tool.version>3.3.1</blade.tool.version> <blade.tool.version>3.4.0</blade.tool.version>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven.plugin.version>3.8.1</maven.plugin.version> <maven.plugin.version>3.8.1</maven.plugin.version>
<swagger.version>2.10.5</swagger.version> <swagger.version>2.10.5</swagger.version>
<swagger.models.version>1.6.2</swagger.models.version> <swagger.models.version>1.6.2</swagger.models.version>
<knife4j.version>2.0.9</knife4j.version> <knife4j.version>2.0.9</knife4j.version>
<mybatis.plus.version>3.5.1</mybatis.plus.version> <mybatis.plus.version>3.5.2</mybatis.plus.version>
<mybatis.plus.generator.version>3.5.2</mybatis.plus.generator.version> <mybatis.plus.generator.version>3.5.3</mybatis.plus.generator.version>
<protostuff.version>1.6.0</protostuff.version> <protostuff.version>1.6.0</protostuff.version>
<disruptor.version>3.4.2</disruptor.version> <disruptor.version>3.4.2</disruptor.version>
<guava.version>20.0</guava.version> <guava.version>20.0</guava.version>
<spring.boot.admin.version>2.6.2</spring.boot.admin.version> <spring.boot.admin.version>2.7.1</spring.boot.admin.version>
<mica.auto.version>1.2.5</mica.auto.version> <mica.auto.version>1.2.5</mica.auto.version>
<alibaba.cloud.version>2021.0.1.0</alibaba.cloud.version> <alibaba.cloud.version>2021.0.1.0</alibaba.cloud.version>
<alibaba.nacos.version>2.0.4</alibaba.nacos.version> <alibaba.nacos.version>2.1.0</alibaba.nacos.version>
<alibaba.seata.version>1.4.2</alibaba.seata.version> <alibaba.seata.version>1.5.1.1</alibaba.seata.version>
<spring.plugin.version>2.0.0.RELEASE</spring.plugin.version> <spring.plugin.version>2.0.0.RELEASE</spring.plugin.version>
<spring.boot.version>2.6.6</spring.boot.version> <spring.boot.version>2.7.1</spring.boot.version>
<spring.cloud.version>2021.0.1</spring.cloud.version> <spring.cloud.version>2021.0.3</spring.cloud.version>
<spring.platform.version>Cairo-SR8</spring.platform.version> <spring.platform.version>Cairo-SR8</spring.platform.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -68,6 +68,7 @@
<module>blade-core-cloud</module> <module>blade-core-cloud</module>
<module>blade-core-develop</module> <module>blade-core-develop</module>
<module>blade-core-launch</module> <module>blade-core-launch</module>
<module>blade-core-loadbalancer</module>
<module>blade-core-log</module> <module>blade-core-log</module>
<module>blade-core-mybatis</module> <module>blade-core-mybatis</module>
<module>blade-core-secure</module> <module>blade-core-secure</module>