mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-11-13 14:09:29 +08:00
🎉 3.4.0.RELEASE 升级适配springboot2.7.1 新增灰度服务功能
This commit is contained in:
parent
f48954ddec
commit
76f0ea534e
31
README.md
31
README.md
@ -1,7 +1,7 @@
|
||||
<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/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>
|
||||
|
||||
## SpringBlade微服务开发平台
|
||||
@ -25,19 +25,23 @@
|
||||
blade-tool
|
||||
├── blade-core-boot -- 业务包综合模块
|
||||
├── blade-core-cloud -- cloud封装模块
|
||||
├── blade-core-datascope -- 数据权限封装模块
|
||||
├── blade-core-develop -- 代码生成封装模块
|
||||
├── blade-core-launch -- 基础启动模块
|
||||
├── blade-core-loadbalancer -- 灰度服务封装模块
|
||||
├── blade-core-log -- 日志封装模块
|
||||
├── blade-core-mybatis -- mybatis拓展封装模块
|
||||
├── blade-core-oss -- 对象存储封装模块
|
||||
├── blade-core-secure -- 安全模块
|
||||
├── blade-core-report -- 报表封装模块
|
||||
├── blade-core-secure -- 安全封装模块
|
||||
├── blade-core-social -- 第三方登录封装模块
|
||||
├── blade-core-swagger -- swagger拓展封装模块
|
||||
├── blade-core-test -- 单元测试封装模块
|
||||
├── blade-core-tool -- 单元测试封装模块
|
||||
└── blade-core-transaction -- 分布式事物封装模块
|
||||
```
|
||||
|
||||
## 官网
|
||||
## 官方信息
|
||||
* 官网地址:[https://bladex.vip](https://bladex.vip)
|
||||
* 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip)
|
||||
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
|
||||
@ -46,23 +50,28 @@ blade-tool
|
||||
* 交流三群:`784729540`(满)
|
||||
* 交流四群:`1034621754`(满)
|
||||
* 交流五群:`946350912`(满)
|
||||
* 交流六群: `511624269`
|
||||
* 交流六群:`511624269`(满)
|
||||
* 交流七群:`298061704`
|
||||
|
||||
## 在线演示
|
||||
* Sword演示地址:[https://sword.bladex.vip](https://sword.bladex.vip)
|
||||
* Saber演示地址:[https://saber.bladex.vip](https://saber.bladex.vip)
|
||||
* 数据大屏演示地址:[https://data.avuejs.com](https://data.avuejs.com)
|
||||
* Saber-基于Vue:[https://saber.bladex.vip](https://saber.bladex.vip)
|
||||
* Sword-基于React:[https://sword.bladex.vip](https://sword.bladex.vip)
|
||||
|
||||
## 数据大屏
|
||||
* 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)
|
||||
* 后端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/)
|
||||
* 前端框架Sword(基于React):[https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword)
|
||||
* 前端框架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))
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -88,13 +88,13 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.22</version>
|
||||
<version>1.2.11</version>
|
||||
</dependency>
|
||||
<!-- MySQL -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.16</version>
|
||||
<version>8.0.22</version>
|
||||
</dependency>
|
||||
<!-- PostgreSql -->
|
||||
<!--<dependency>
|
||||
|
@ -19,9 +19,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.launch.props.BladeProperties;
|
||||
import org.springblade.core.tool.constant.SystemConstant;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
/**
|
||||
@ -30,7 +30,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
* @author Chill
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties({
|
||||
BladeProperties.class
|
||||
})
|
||||
|
@ -17,8 +17,8 @@ package org.springblade.core.boot.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.boot.resolver.TokenArgumentResolver;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
@ -31,7 +31,7 @@ import java.util.List;
|
||||
* @author Chill
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@EnableCaching
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public class BladeWebMvcConfiguration implements WebMvcConfigurer {
|
||||
|
@ -16,9 +16,9 @@
|
||||
package org.springblade.core.boot.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.retry.interceptor.RetryInterceptorBuilder;
|
||||
import org.springframework.retry.interceptor.RetryOperationsInterceptor;
|
||||
|
||||
@ -28,7 +28,7 @@ import org.springframework.retry.interceptor.RetryOperationsInterceptor;
|
||||
* @author Chill
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
public class RetryConfiguration {
|
||||
|
||||
@Bean
|
||||
|
@ -11,7 +11,7 @@ import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.ClassUtil;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
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.core.MethodParameter;
|
||||
import org.springframework.core.io.InputStreamSource;
|
||||
@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
*/
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@Profile({AppConstant.DEV_CODE, AppConstant.TEST_CODE})
|
||||
public class RequestLogAspect {
|
||||
|
||||
|
@ -19,11 +19,11 @@ import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.config.MybatisPlusConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Primary;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@AutoConfigureBefore(MybatisPlusConfiguration.class)
|
||||
@EnableConfigurationProperties(BladeTenantProperties.class)
|
||||
|
@ -101,7 +101,7 @@ mybatis-plus:
|
||||
swagger:
|
||||
title: SpringBlade 接口文档系统
|
||||
description: SpringBlade 接口文档系统
|
||||
version: 3.3.1
|
||||
version: 3.4.0
|
||||
license: Powered By SpringBlade
|
||||
licenseUrl: https://bladex.vip
|
||||
terms-of-service-url: https://bladex.vip
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* 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" />
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* 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" />
|
||||
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* 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" />
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.75</version>
|
||||
<version>1.2.83_noneautotype</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -22,11 +22,11 @@ import feign.RequestInterceptor;
|
||||
import org.springblade.core.cloud.feign.BladeFeignSentinel;
|
||||
import org.springblade.core.cloud.header.BladeFeignRequestHeaderInterceptor;
|
||||
import org.springblade.core.cloud.sentinel.BladeBlockExceptionHandler;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
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,7 +36,7 @@ import org.springframework.context.annotation.Scope;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@Import(BladeSentinelFilterConfiguration.class)
|
||||
@AutoConfigureBefore(SentinelFeignAutoConfiguration.class)
|
||||
public class BladeCloudAutoConfiguration {
|
||||
|
@ -104,6 +104,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
|
||||
public interface Logger {
|
||||
/**
|
||||
* log
|
||||
*
|
||||
* @param message 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.
|
||||
*/
|
||||
Logger DEFAULT = message -> Platform.get().log(INFO, message, null);
|
||||
Logger DEFAULT = message -> Platform.get().log(message, INFO, null);
|
||||
}
|
||||
|
||||
public HttpLoggingInterceptor() {
|
||||
@ -128,6 +129,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
|
||||
|
||||
/**
|
||||
* Change the level at which this interceptor logs.
|
||||
*
|
||||
* @param level log Level
|
||||
* @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.
|
||||
*/
|
||||
private static int plainCnt = 16;
|
||||
|
||||
private static boolean isPlaintext(Buffer buffer) {
|
||||
try {
|
||||
Buffer prefix = new Buffer();
|
||||
|
@ -22,6 +22,7 @@ import org.springblade.core.cloud.header.BladeFeignAccountGetter;
|
||||
import org.springblade.core.cloud.props.BladeFeignHeadersProperties;
|
||||
import org.springblade.core.tool.utils.Charsets;
|
||||
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.ConditionalOnMissingBean;
|
||||
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.openfeign.support.FeignHttpClientProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
@ -48,7 +48,7 @@ import java.util.concurrent.TimeUnit;
|
||||
*
|
||||
* @author L.cm
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@ConditionalOnClass(okhttp3.OkHttpClient.class)
|
||||
@EnableConfigurationProperties(BladeFeignHeadersProperties.class)
|
||||
|
@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springblade.core.cloud.version;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* url版本号处理
|
||||
@ -27,7 +27,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author L.cm
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnWebApplication
|
||||
public class VersionMappingAutoConfiguration {
|
||||
@Bean
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -22,11 +22,11 @@ import org.springblade.core.datascope.handler.DataScopeHandler;
|
||||
import org.springblade.core.datascope.handler.ScopeModelHandler;
|
||||
import org.springblade.core.datascope.interceptor.DataScopeInterceptor;
|
||||
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.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
/**
|
||||
@ -34,7 +34,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@EnableConfigurationProperties(DataScopeProperties.class)
|
||||
public class DataScopeConfiguration {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -20,12 +20,14 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.config.OutputFile;
|
||||
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.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.develop.constant.DevelopConstant;
|
||||
@ -36,6 +38,7 @@ import org.springframework.core.io.support.PropertiesLoaderUtils;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@ -91,6 +94,10 @@ public class BladeCodeGenerator {
|
||||
* 是否包含包装器
|
||||
*/
|
||||
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())
|
||||
.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)
|
||||
.entityBuilder().naming(NamingStrategy.underline_to_camel).columnNaming(NamingStrategy.underline_to_camel).enableLombok().superClass("org.springblade.core.mp.base.BaseEntity").addSuperEntityColumns(superEntityColumns)
|
||||
.serviceBuilder().superServiceClass("org.springblade.core.mp.base.BaseService").superServiceImplClass("org.springblade.core.mp.base.BaseServiceImpl").formatServiceFileName("I%sService").formatServiceImplFileName("%sServiceImpl")
|
||||
.mapperBuilder().enableMapperAnnotation().enableBaseResultMap().enableBaseColumnList().formatMapperFileName("%sMapper").formatXmlFileName("%sMapper")
|
||||
.controllerBuilder().superClass("org.springblade.core.boot.ctrl.BladeController").formatFileName("%sController").enableRestStyle().enableHyphenStyle()
|
||||
.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").enableFileOverride()
|
||||
.mapperBuilder().mapperAnnotation(Mapper.class).enableBaseResultMap().enableBaseColumnList().formatMapperFileName("%sMapper").formatXmlFileName("%sMapper").enableFileOverride()
|
||||
.controllerBuilder().superClass("org.springblade.core.boot.ctrl.BladeController").formatFileName("%sController").enableRestStyle().enableHyphenStyle().enableFileOverride()
|
||||
)
|
||||
.templateConfig(builder -> builder.disable(TemplateType.ENTITY)
|
||||
.entity("/templates/entity.java.vm")
|
||||
@ -177,14 +184,16 @@ public class BladeCodeGenerator {
|
||||
)
|
||||
.templateEngine(new VelocityTemplateEngine() {
|
||||
@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 entityNameLower = tableInfo.getEntityName().toLowerCase();
|
||||
|
||||
customFile.forEach((key, value) -> {
|
||||
String outputPath = getPathInfo(OutputFile.other);
|
||||
customFiles.forEach(customFile -> {
|
||||
String key = customFile.getFileName();
|
||||
String value = customFile.getTemplatePath();
|
||||
String outputPath = getPathInfo(OutputFile.parent);
|
||||
objectMap.put("entityKey", entityNameLower);
|
||||
if (StringUtil.equals(key, "menu.sql")) {
|
||||
objectMap.put("entityKey", entityNameLower);
|
||||
objectMap.put("menuId", IdWorker.getId());
|
||||
objectMap.put("addMenuId", IdWorker.getId());
|
||||
objectMap.put("editMenuId", IdWorker.getId());
|
||||
|
@ -53,7 +53,7 @@ import $!{superControllerClassPackage};
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("#if($!{package.ModuleName})$!{package.ModuleName}#end/$!{entityKey}")
|
||||
@RequestMapping("#if($!{hasServiceName})/$!{serviceName}#end/$!{entityKey}")
|
||||
@Api(value = "$!{table.comment}", tags = "$!{table.comment}接口")
|
||||
#if($!{superControllerClass})
|
||||
public class $!{table.controllerName} extends $!{superControllerClass} {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -16,8 +16,8 @@
|
||||
package org.springblade.core.launch;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.web.context.WebServerInitializedEvent;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
@ -30,7 +30,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Chill
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
public class StartEventListener {
|
||||
|
||||
@Async
|
||||
|
@ -17,8 +17,8 @@ package org.springblade.core.launch.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.launch.props.BladeProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
@ -27,7 +27,7 @@ import org.springframework.core.annotation.Order;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@EnableConfigurationProperties({
|
||||
|
@ -25,7 +25,7 @@ public interface AppConstant {
|
||||
/**
|
||||
* 应用版本
|
||||
*/
|
||||
String APPLICATION_VERSION = "3.3.1";
|
||||
String APPLICATION_VERSION = "3.4.0";
|
||||
|
||||
/**
|
||||
* 基础包
|
||||
|
@ -19,8 +19,8 @@ import lombok.Getter;
|
||||
import org.springblade.core.launch.utils.INetUtil;
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
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
|
||||
*/
|
||||
@Getter
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
public class ServerInfo implements SmartInitializingSingleton {
|
||||
private final ServerProperties serverProperties;
|
||||
private String hostName;
|
||||
|
75
blade-core-loadbalancer/pom.xml
Normal file
75
blade-core-loadbalancer/pom.xml
Normal 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>
|
@ -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});
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
|
||||
}
|
@ -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<>();
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -19,6 +19,7 @@ package org.springblade.core.log.config;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.log.error.BladeErrorAttributes;
|
||||
import org.springblade.core.log.error.BladeErrorController;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
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.ErrorController;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
import javax.servlet.Servlet;
|
||||
@ -41,7 +41,7 @@ import javax.servlet.Servlet;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@ConditionalOnWebApplication
|
||||
@AutoConfigureBefore(ErrorMvcAutoConfiguration.class)
|
||||
|
@ -17,24 +17,24 @@
|
||||
package org.springblade.core.log.config;
|
||||
|
||||
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.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.logger.BladeLogger;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 日志工具自动配置
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@ConditionalOnWebApplication
|
||||
public class BladeLogToolAutoConfiguration {
|
||||
|
@ -25,9 +25,9 @@ import org.springblade.core.tool.api.ResultCode;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.UrlUtil;
|
||||
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.ConditionalOnWebApplication;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.validation.BindException;
|
||||
@ -55,7 +55,7 @@ import java.util.Set;
|
||||
* @author Chill
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass({Servlet.class, DispatcherServlet.class})
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
@RestControllerAdvice
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -31,11 +31,11 @@ import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.ObjectUtil;
|
||||
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.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@MapperScan("org.springblade.**.mapper.**")
|
||||
@EnableConfigurationProperties(MybatisPlusProperties.class)
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -24,20 +24,20 @@ import org.springblade.core.oss.AliossTemplate;
|
||||
import org.springblade.core.oss.props.OssProperties;
|
||||
import org.springblade.core.oss.rule.BladeOssRule;
|
||||
import org.springblade.core.oss.rule.OssRule;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Alioss配置类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@AutoConfigureAfter(QiniuConfiguration.class)
|
||||
@EnableConfigurationProperties(OssProperties.class)
|
||||
|
@ -24,19 +24,19 @@ import org.springblade.core.oss.QiniuTemplate;
|
||||
import org.springblade.core.oss.props.OssProperties;
|
||||
import org.springblade.core.oss.rule.BladeOssRule;
|
||||
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.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Oss配置类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@EnableConfigurationProperties(OssProperties.class)
|
||||
@ConditionalOnProperty(value = "oss.name", havingValue = "qiniu")
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -23,12 +23,12 @@ import org.springblade.core.report.props.ReportProperties;
|
||||
import org.springblade.core.report.provider.DatabaseProvider;
|
||||
import org.springblade.core.report.provider.ReportPlaceholderProvider;
|
||||
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.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
@ -40,7 +40,7 @@ import javax.servlet.Servlet;
|
||||
* @author Chill
|
||||
*/
|
||||
@Order
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(value = "report.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@EnableConfigurationProperties({ReportProperties.class, ReportDatabaseProperties.class})
|
||||
@ImportResource("classpath:ureport-console-context.xml")
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -17,10 +17,10 @@ package org.springblade.core.secure.config;
|
||||
|
||||
|
||||
import org.springblade.core.secure.registry.SecureRegistry;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
/**
|
||||
@ -29,7 +29,7 @@ import org.springframework.core.annotation.Order;
|
||||
* @author Chill
|
||||
*/
|
||||
@Order
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AutoConfigureBefore(SecureConfiguration.class)
|
||||
public class RegistryConfiguration {
|
||||
|
||||
|
@ -24,10 +24,10 @@ import org.springblade.core.secure.props.BladeSecureProperties;
|
||||
import org.springblade.core.secure.provider.ClientDetailsServiceImpl;
|
||||
import org.springblade.core.secure.provider.IClientDetailsService;
|
||||
import org.springblade.core.secure.registry.SecureRegistry;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
@ -39,7 +39,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
* @author Chill
|
||||
*/
|
||||
@Order
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@EnableConfigurationProperties({BladeSecureProperties.class})
|
||||
public class SecureConfiguration implements WebMvcConfigurer {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -19,17 +19,17 @@ import com.xkcoding.http.HttpUtil;
|
||||
import com.xkcoding.http.support.Http;
|
||||
import com.xkcoding.http.support.httpclient.HttpClientImpl;
|
||||
import org.springblade.core.social.props.SocialProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* SocialConfiguration
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(SocialProperties.class)
|
||||
public class SocialConfiguration {
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -20,10 +20,10 @@ import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.launch.props.BladeProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
@ -44,7 +44,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@EnableSwagger
|
||||
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||
@Import(BeanValidatorPluginsConfiguration.class)
|
||||
|
@ -17,8 +17,8 @@ package org.springblade.core.swagger;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
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;
|
||||
@ -32,7 +32,7 @@ import java.util.stream.Collectors;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
public class SwaggerHandlerConfiguration {
|
||||
|
||||
@Bean
|
||||
|
@ -55,7 +55,7 @@ public class SwaggerProperties {
|
||||
/**
|
||||
* 版本
|
||||
**/
|
||||
private String version = "3.3.1";
|
||||
private String version = "3.4.0";
|
||||
/**
|
||||
* 许可证
|
||||
**/
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -23,11 +23,11 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.jackson.BladeJavaTimeModule;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
|
||||
@ -41,7 +41,7 @@ import java.util.TimeZone;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@ConditionalOnClass(ObjectMapper.class)
|
||||
@AutoConfigureBefore(JacksonAutoConfiguration.class)
|
||||
|
@ -20,7 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.jackson.MappingApiJackson2HttpMessageConverter;
|
||||
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.annotation.Order;
|
||||
import org.springframework.http.converter.*;
|
||||
@ -34,7 +34,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public class MessageConfiguration implements WebMvcConfigurer {
|
||||
|
@ -17,6 +17,7 @@ package org.springblade.core.tool.config;
|
||||
|
||||
import org.springblade.core.tool.redis.RedisKeySerializer;
|
||||
import org.springblade.core.tool.utils.RedisUtil;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
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.annotation.EnableCaching;
|
||||
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.RedisCacheManager;
|
||||
import org.springframework.data.redis.cache.RedisCacheWriter;
|
||||
@ -41,7 +41,7 @@ import java.time.Duration;
|
||||
* @author Chill
|
||||
*/
|
||||
@EnableCaching
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AutoConfigureBefore(RedisAutoConfiguration.class)
|
||||
public class RedisTemplateConfiguration {
|
||||
|
||||
|
@ -19,10 +19,10 @@ import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.request.BladeRequestFilter;
|
||||
import org.springblade.core.tool.request.RequestProperties;
|
||||
import org.springblade.core.tool.request.XssProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
@ -32,7 +32,7 @@ import javax.servlet.DispatcherType;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@AllArgsConstructor
|
||||
@EnableConfigurationProperties({RequestProperties.class, XssProperties.class})
|
||||
public class RequestConfiguration {
|
||||
|
@ -17,8 +17,8 @@ package org.springblade.core.tool.config;
|
||||
|
||||
|
||||
import org.springblade.core.tool.utils.SpringUtil;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@ -28,7 +28,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public class ToolConfiguration implements WebMvcConfigurer {
|
||||
|
||||
|
@ -1,18 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
/**
|
||||
* 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.tool.utils;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -15,14 +15,14 @@
|
||||
*/
|
||||
package org.springblade.core.transaction.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
|
||||
/**
|
||||
* 分布式事务数据源配置
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
public class DataSourceConfiguration {
|
||||
|
||||
}
|
||||
|
19
pom.xml
19
pom.xml
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>blade-tool</name>
|
||||
<description>
|
||||
@ -36,27 +36,27 @@
|
||||
</scm>
|
||||
|
||||
<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>
|
||||
<maven.plugin.version>3.8.1</maven.plugin.version>
|
||||
<swagger.version>2.10.5</swagger.version>
|
||||
<swagger.models.version>1.6.2</swagger.models.version>
|
||||
<knife4j.version>2.0.9</knife4j.version>
|
||||
<mybatis.plus.version>3.5.1</mybatis.plus.version>
|
||||
<mybatis.plus.generator.version>3.5.2</mybatis.plus.generator.version>
|
||||
<mybatis.plus.version>3.5.2</mybatis.plus.version>
|
||||
<mybatis.plus.generator.version>3.5.3</mybatis.plus.generator.version>
|
||||
<protostuff.version>1.6.0</protostuff.version>
|
||||
<disruptor.version>3.4.2</disruptor.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>
|
||||
<alibaba.cloud.version>2021.0.1.0</alibaba.cloud.version>
|
||||
<alibaba.nacos.version>2.0.4</alibaba.nacos.version>
|
||||
<alibaba.seata.version>1.4.2</alibaba.seata.version>
|
||||
<alibaba.nacos.version>2.1.0</alibaba.nacos.version>
|
||||
<alibaba.seata.version>1.5.1.1</alibaba.seata.version>
|
||||
<spring.plugin.version>2.0.0.RELEASE</spring.plugin.version>
|
||||
|
||||
<spring.boot.version>2.6.6</spring.boot.version>
|
||||
<spring.cloud.version>2021.0.1</spring.cloud.version>
|
||||
<spring.boot.version>2.7.1</spring.boot.version>
|
||||
<spring.cloud.version>2021.0.3</spring.cloud.version>
|
||||
<spring.platform.version>Cairo-SR8</spring.platform.version>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -68,6 +68,7 @@
|
||||
<module>blade-core-cloud</module>
|
||||
<module>blade-core-develop</module>
|
||||
<module>blade-core-launch</module>
|
||||
<module>blade-core-loadbalancer</module>
|
||||
<module>blade-core-log</module>
|
||||
<module>blade-core-mybatis</module>
|
||||
<module>blade-core-secure</module>
|
||||
|
Loading…
Reference in New Issue
Block a user