Parcourir la source

bump: 发布 1.7.0

https://helio.uncarbon.cc/#/i18n/zh-CN/appendix/change-log
Uncarbon il y a 3 ans
Parent
commit
5a57718e10
50 fichiers modifiés avec 184 ajouts et 142 suppressions
  1. 2 3
      helio-core/src/main/java/cc/uncarbon/framework/core/config/AdaptHistoryVersionAutoConfiguration.java
  2. 3 3
      helio-core/src/main/java/cc/uncarbon/framework/core/config/HelioPropertiesAutoConfiguration.java
  3. 1 1
      helio-core/src/main/java/cc/uncarbon/framework/core/enums/HelioBaseEnum.java
  4. 1 1
      helio-core/src/main/java/cc/uncarbon/framework/core/function/StreamFunction.java
  5. 3 6
      helio-core/src/main/java/cc/uncarbon/framework/core/page/PageParam.java
  6. 7 9
      helio-core/src/main/java/cc/uncarbon/framework/core/page/PageResult.java
  7. 0 3
      helio-core/src/main/resources/META-INF/spring.factories
  8. 2 0
      helio-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  9. 0 1
      helio-starter-aop/src/main/resources/META-INF/spring.factories
  10. 0 0
      helio-starter-aop/src/main/resources/PLACEHOLDER
  11. 4 2
      helio-starter-cloud/src/main/java/cc/uncarbon/framework/cloud/config/NacosConfigAutoConfiguration.java
  12. 4 2
      helio-starter-cloud/src/main/java/cc/uncarbon/framework/cloud/config/NacosDiscoveryAutoConfiguration.java
  13. 0 3
      helio-starter-cloud/src/main/resources/META-INF/spring.factories
  14. 2 0
      helio-starter-cloud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  15. 5 0
      helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/DynamicDataSourceAutoConfiguration.java
  16. 3 3
      helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/HelioMybatisPlusAutoConfiguration.java
  17. 2 1
      helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/InitHikariPoolAtStartupConfiguration.java
  18. 0 1
      helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/dynamicdatasource/HelioDynamicDataSourceRegistry.java
  19. 0 3
      helio-starter-crud/src/main/resources/META-INF/spring.factories
  20. 2 0
      helio-starter-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  21. 0 0
      helio-starter-crud/src/main/resources/application.yml
  22. 4 0
      helio-starter-dubbo/src/main/java/cc/uncarbon/framework/dubbo/filter/ProviderContextFilter.java
  23. 4 5
      helio-starter-knife4j/src/main/java/cc/uncarbon/framework/knife4j/config/HelioKnife4jAutoConfiguration.java
  24. 6 6
      helio-starter-knife4j/src/main/java/cc/uncarbon/framework/knife4j/config/Knife4jEnumPropertyAutoConfiguration.java
  25. 0 3
      helio-starter-knife4j/src/main/resources/META-INF/spring.factories
  26. 2 0
      helio-starter-knife4j/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  27. 5 5
      helio-starter-redis/src/main/java/cc/uncarbon/framework/redis/config/HelioRedisAutoConfiguration.java
  28. 0 2
      helio-starter-redis/src/main/resources/META-INF/spring.factories
  29. 1 0
      helio-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  30. 5 8
      helio-starter-rocketmq-aliyun/src/main/java/cc/uncarbon/framework/rocketmq/config/AliyunRocketAutoConfiguration.java
  31. 0 2
      helio-starter-rocketmq-aliyun/src/main/resources/META-INF/spring.factories
  32. 1 0
      helio-starter-rocketmq-aliyun/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  33. 0 1
      helio-starter-seata/src/main/resources/META-INF/spring.factories
  34. 0 0
      helio-starter-seata/src/main/resources/PLACEHOLDER
  35. 5 4
      helio-starter-tenant/src/main/java/cc/uncarbon/framework/tenant/config/HelioTenantAutoConfiguration.java
  36. 0 2
      helio-starter-tenant/src/main/resources/META-INF/spring.factories
  37. 1 0
      helio-starter-tenant/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  38. 0 1
      helio-starter-test/src/main/resources/META-INF/spring.factories
  39. 0 0
      helio-starter-test/src/main/resources/PLACEHOLDER
  40. 12 7
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/AdviceExceptionAutoConfiguration.java
  41. 3 3
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/DefaultWebMvcAutoConfiguration.java
  42. 7 8
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/JacksonExtendAutoConfiguration.java
  43. 13 9
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/MessageConverterAutoConfiguration.java
  44. 3 3
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/XssAutoConfiguration.java
  45. 2 5
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/model/response/ApiResult.java
  46. 49 6
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/util/InvalidFieldUtil.java
  47. 0 7
      helio-starter-web/src/main/resources/META-INF/spring.factories
  48. 6 0
      helio-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  49. 5 4
      helio-starter-web/src/main/resources/application.yml
  50. 9 9
      pom.xml

+ 2 - 3
helio-core/src/main/java/cc/uncarbon/framework/core/config/AdaptHistoryVersionAutoConfiguration.java

@@ -7,9 +7,9 @@ import java.util.Map;
 import java.util.Set;
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.env.OriginTrackedMapPropertySource;
 import org.springframework.context.EnvironmentAware;
-import org.springframework.context.annotation.Configuration;
 import org.springframework.core.env.ConfigurableEnvironment;
 import org.springframework.core.env.Environment;
 import org.springframework.core.env.MutablePropertySources;
@@ -18,10 +18,9 @@ import org.springframework.core.env.PropertySource;
 /**
  * 兼容历史版本 自动配置类
  *
- * @author kong
  * @author Uncarbon
  */
-@Configuration
+@AutoConfiguration
 @RequiredArgsConstructor
 public class AdaptHistoryVersionAutoConfiguration implements EnvironmentAware {
 

+ 3 - 3
helio-core/src/main/java/cc/uncarbon/framework/core/config/HelioPropertiesAutoConfiguration.java

@@ -1,16 +1,16 @@
 package cc.uncarbon.framework.core.config;
 
 import cc.uncarbon.framework.core.props.HelioProperties;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
 
 /**
- * 自动配置文件读取
+ * properties 解析自动配置类
  *
  * @author Uncarbon
  */
 @EnableConfigurationProperties(value = {HelioProperties.class})
-@Configuration
+@AutoConfiguration
 public class HelioPropertiesAutoConfiguration {
 
 }

+ 1 - 1
helio-core/src/main/java/cc/uncarbon/framework/core/enums/HelioBaseEnum.java

@@ -143,7 +143,7 @@ public interface HelioBaseEnum<T> extends Serializable {
     }
 
     default String formatLabel(Object... templateParams) {
-        if (templateParams == null || templateParams.length <= 0) {
+        if (templateParams == null || templateParams.length == 0) {
             return this.getLabel();
         }
 

+ 1 - 1
helio-core/src/main/java/cc/uncarbon/framework/core/function/StreamFunction.java

@@ -11,7 +11,7 @@ import java.util.function.BinaryOperator;
 public class StreamFunction {
 
     /**
-     * 用于 stream-collect-toMap 时,忽略已存在的 key & value;不忽略的话,遇到重复项时默认会抛出异常
+     * 用于 stream-collect-toMap 时,直接覆盖已存在的 key;不忽略的话,遇到重复项时默认会抛出异常
      *
      * 用法:stream().collect(Collectors.toMap( XXX, XXX, StreamFunction.ignoredThrowingMerger()))
      *

+ 3 - 6
helio-core/src/main/java/cc/uncarbon/framework/core/page/PageParam.java

@@ -1,31 +1,28 @@
 package cc.uncarbon.framework.core.page;
 
-import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
-import lombok.experimental.SuperBuilder;
 
 import java.io.Serializable;
 
 /**
  * 分页查询参数
+ *
  * @author Uncarbon
  */
-@ApiModel(value = "分页查询参数")
 @Accessors(chain = true)
-@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
 public class PageParam implements Serializable {
 
     @ApiModelProperty(value = "当前页码")
-    private Integer pageNum = 1;
+    private int pageNum = 1;
 
     @ApiModelProperty(value = "当前页大小")
-    private Integer pageSize = 10;
+    private int pageSize = 10;
 
 }

+ 7 - 9
helio-core/src/main/java/cc/uncarbon/framework/core/page/PageResult.java

@@ -1,33 +1,31 @@
 package cc.uncarbon.framework.core.page;
 
-import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
-import lombok.experimental.SuperBuilder;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * 分页查询结果
+ *
  * @author Uncarbon
  */
-@ApiModel(value = "分页查询结果")
 @Accessors(chain = true)
-@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
 public class PageResult<T extends Serializable> implements Serializable {
 
     @ApiModelProperty(value = "当前页")
-    private int current;
+    private long current;
 
     @ApiModelProperty(value = "当前页数量")
-    private int size;
+    private long size;
 
     @ApiModelProperty(value = "总量")
     private long total;

+ 0 - 3
helio-core/src/main/resources/META-INF/spring.factories

@@ -1,3 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.core.config.HelioPropertiesAutoConfiguration,\
-  cc.uncarbon.framework.core.config.AdaptHistoryVersionAutoConfiguration

+ 2 - 0
helio-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1,2 @@
+cc.uncarbon.framework.core.config.HelioPropertiesAutoConfiguration
+cc.uncarbon.framework.core.config.AdaptHistoryVersionAutoConfiguration

+ 0 - 1
helio-starter-aop/src/main/resources/META-INF/spring.factories

@@ -1 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=

+ 0 - 0
helio-starter-aop/src/main/resources/PLACEHOLDER


+ 4 - 2
helio-starter-cloud/src/main/java/cc/uncarbon/framework/cloud/config/NacosConfigAutoConfiguration.java

@@ -1,12 +1,14 @@
 package cc.uncarbon.framework.cloud.config;
 
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
-import org.springframework.context.annotation.Configuration;
 
 /**
+ * 启用配置自动刷新 自动配置类
+ *
  * @author Uncarbon
  */
 @RefreshScope
-@Configuration
+@AutoConfiguration
 public class NacosConfigAutoConfiguration {
 }

+ 4 - 2
helio-starter-cloud/src/main/java/cc/uncarbon/framework/cloud/config/NacosDiscoveryAutoConfiguration.java

@@ -1,12 +1,14 @@
 package cc.uncarbon.framework.cloud.config;
 
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.context.annotation.Configuration;
 
 /**
+ * 启用服务发现 自动配置类
+ *
  * @author Uncarbon
  */
 @EnableDiscoveryClient
-@Configuration
+@AutoConfiguration
 public class NacosDiscoveryAutoConfiguration {
 }

+ 0 - 3
helio-starter-cloud/src/main/resources/META-INF/spring.factories

@@ -1,3 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.cloud.config.NacosDiscoveryAutoConfiguration,\
-  cc.uncarbon.framework.cloud.config.NacosConfigAutoConfiguration

+ 2 - 0
helio-starter-cloud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1,2 @@
+cc.uncarbon.framework.cloud.config.NacosDiscoveryAutoConfiguration
+cc.uncarbon.framework.cloud.config.NacosConfigAutoConfiguration

+ 5 - 0
helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/DynamicDataSourceAutoConfiguration.java

@@ -8,6 +8,11 @@ import org.springframework.beans.factory.ObjectProvider;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.context.annotation.Bean;
 
+/**
+ * 动态数据源自动配置类
+ *
+ * @author Uncarbon
+ */
 @ConditionalOnClass(value = DynamicRoutingDataSource.class)
 public class DynamicDataSourceAutoConfiguration {
 

+ 3 - 3
helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/HelioMybatisPlusAutoConfiguration.java

@@ -12,20 +12,20 @@ import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInt
 import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
 import lombok.RequiredArgsConstructor;
 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.transaction.annotation.EnableTransactionManagement;
 
 /**
- * Mybatis-Plus配置类
+ * Helio Mybatis-Plus 自动配置类
  *
  * @author Uncarbon
  */
 @EnableTransactionManagement(
         proxyTargetClass = true
 )
-@Configuration
+@AutoConfiguration
 @Slf4j
 @RequiredArgsConstructor
 public class HelioMybatisPlusAutoConfiguration {

+ 2 - 1
helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/InitHikariPoolAtStartupConfiguration.java

@@ -6,7 +6,8 @@ import org.springframework.context.annotation.Bean;
 
 
 /**
- * 在项目启动时直接初始化Hikari连接池, 关闭按需连接
+ * 在项目启动时直接初始化 Hikari 连接池(否则默认为懒加载)
+ *
  * @author Uncarbon
  */
 public class InitHikariPoolAtStartupConfiguration {

+ 0 - 1
helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/dynamicdatasource/HelioDynamicDataSourceRegistry.java

@@ -18,7 +18,6 @@ import org.springframework.beans.factory.ObjectProvider;
  */
 @RequiredArgsConstructor
 @Slf4j
-// @ConditionalOnClass(value = DynamicRoutingDataSource.class)
 public class HelioDynamicDataSourceRegistry {
 
     private final DynamicRoutingDataSource dynamicRoutingDataSource;

+ 0 - 3
helio-starter-crud/src/main/resources/META-INF/spring.factories

@@ -1,3 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.crud.config.HelioMybatisPlusAutoConfiguration,\
-  cc.uncarbon.framework.crud.config.DynamicDataSourceAutoConfiguration

+ 2 - 0
helio-starter-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1,2 @@
+cc.uncarbon.framework.crud.config.HelioMybatisPlusAutoConfiguration
+cc.uncarbon.framework.crud.config.DynamicDataSourceAutoConfiguration

+ 0 - 0
helio-starter-crud/src/main/resources/config/application.yml → helio-starter-crud/src/main/resources/application.yml


+ 4 - 0
helio-starter-dubbo/src/main/java/cc/uncarbon/framework/dubbo/filter/ProviderContextFilter.java

@@ -26,6 +26,10 @@ public class ProviderContextFilter implements Filter {
         since 1.6.0 附件内容不再是 JSON 字符串,直接使用可序列化的对象
          */
 
+        // 清理数据,避免线程池化复用残留
+        UserContextHolder.clear();
+        TenantContextHolder.clear();
+
         Object attachment = RpcContext.getServerAttachment().getObjectAttachment(UserContext.CAMEL_NAME);
         if (attachment instanceof UserContext) {
             UserContext userContext = (UserContext) attachment;

+ 4 - 5
helio-starter-knife4j/src/main/java/cc/uncarbon/framework/knife4j/config/HelioKnife4jAutoConfiguration.java

@@ -4,10 +4,12 @@ package cc.uncarbon.framework.knife4j.config;
 import cc.uncarbon.framework.core.props.HelioProperties;
 import cn.hutool.core.collection.CollUtil;
 import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
+import java.util.ArrayList;
+import java.util.List;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 import org.springframework.core.annotation.Order;
 import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
@@ -23,9 +25,6 @@ import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spi.service.contexts.SecurityContext;
 import springfox.documentation.spring.web.plugins.Docket;
 
-import java.util.ArrayList;
-import java.util.List;
-
 
 /**
  * Helio knife4j 自动配置类
@@ -38,7 +37,7 @@ import java.util.List;
 @EnableOpenApi
 @EnableKnife4j
 @Import(BeanValidatorPluginsConfiguration.class)
-@Configuration
+@AutoConfiguration
 public class HelioKnife4jAutoConfiguration {
 
     @Value(value = "${sa-token.token-name:Authorization}")

+ 6 - 6
helio-starter-knife4j/src/main/java/cc/uncarbon/framework/knife4j/config/Knife4jEnumPropertyAutoConfiguration.java

@@ -2,18 +2,18 @@ package cc.uncarbon.framework.knife4j.config;
 
 import cc.uncarbon.framework.core.enums.HelioBaseEnum;
 import io.swagger.annotations.ApiModelProperty;
+import java.util.Optional;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Component;
 import springfox.documentation.schema.Annotations;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spi.schema.ModelPropertyBuilderPlugin;
 import springfox.documentation.spi.schema.contexts.ModelPropertyContext;
 import springfox.documentation.swagger.schema.ApiModelProperties;
 
-import java.util.Optional;
-
 /**
- * 非生产环境下,为 Knife4j 文档生成枚举类描述
+ * knife4j 枚举增强自动配置类
+ * 非生产环境下,为 knife4j 文档生成枚举类描述
  * 示例代码:
  *     @ApiModelProperty(value = "性别")
  *     private GenderEnum gender;
@@ -25,7 +25,7 @@ import java.util.Optional;
  * @author Uncarbon
  */
 @ConditionalOnProperty(prefix = "knife4j", value = "production", havingValue = "false")
-@Component
+@AutoConfiguration
 public class Knife4jEnumPropertyAutoConfiguration implements ModelPropertyBuilderPlugin {
 
     @Override
@@ -71,7 +71,7 @@ public class Knife4jEnumPropertyAutoConfiguration implements ModelPropertyBuilde
                     newDescription.append(" ");
                 }
             }
-            newDescription.append(")");
+            newDescription.append(")<br />");
 
             // 更新文档中的描述
             context.getSpecificationBuilder().description(newDescription.toString());

+ 0 - 3
helio-starter-knife4j/src/main/resources/META-INF/spring.factories

@@ -1,3 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.knife4j.config.HelioKnife4jAutoConfiguration,\
-  cc.uncarbon.framework.knife4j.config.Knife4jEnumPropertyAutoConfiguration

+ 2 - 0
helio-starter-knife4j/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1,2 @@
+cc.uncarbon.framework.knife4j.config.HelioKnife4jAutoConfiguration
+cc.uncarbon.framework.knife4j.config.Knife4jEnumPropertyAutoConfiguration

+ 5 - 5
helio-starter-redis/src/main/java/cc/uncarbon/framework/redis/config/HelioRedisAutoConfiguration.java

@@ -4,12 +4,12 @@ import cc.uncarbon.framework.redis.lock.RedisDistributedLock;
 import cc.uncarbon.framework.redis.lock.impl.RedisDistributedLockImpl;
 import lombok.RequiredArgsConstructor;
 import org.redisson.api.RedissonClient;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.cache.interceptor.KeyGenerator;
 import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
@@ -17,19 +17,19 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
 
 
 /**
- * Redis 配置类
+ * Helio Redis 自动配置类
  *
  * @author zuihou
  * @author Mark sunlightcs@gmail.com
+ * @author Uncarbon
  */
 @RequiredArgsConstructor
 @EnableCaching
 @ConditionalOnClass(RedisConnectionFactory.class)
-@Configuration
+@AutoConfiguration
 public class HelioRedisAutoConfiguration {
 
     private final RedisConnectionFactory factory;
-
     private final RedissonClient redissonClient;
 
 
@@ -69,7 +69,7 @@ public class HelioRedisAutoConfiguration {
     @ConditionalOnMissingBean
     public KeyGenerator keyGenerator() {
         return (target, method, objects) -> {
-            StringBuilder sb = new StringBuilder();
+            StringBuilder sb = new StringBuilder(64);
             sb.append(target.getClass().getName());
             sb.append(":");
             sb.append(method.getName());

+ 0 - 2
helio-starter-redis/src/main/resources/META-INF/spring.factories

@@ -1,2 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.redis.config.HelioRedisAutoConfiguration

+ 1 - 0
helio-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1 @@
+cc.uncarbon.framework.redis.config.HelioRedisAutoConfiguration

+ 5 - 8
helio-starter-rocketmq-aliyun/src/main/java/cc/uncarbon/framework/rocketmq/config/AliyunRocketAutoConfiguration.java

@@ -22,31 +22,28 @@ import cc.uncarbon.framework.rocketmq.container.RocketProducerContainer;
 import cc.uncarbon.framework.rocketmq.core.serializer.JacksonJsonSerializer;
 import cc.uncarbon.framework.rocketmq.core.serializer.RocketSerializer;
 import cc.uncarbon.framework.rocketmq.props.AliyunRocketProperties;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import lombok.RequiredArgsConstructor;
+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 java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 
 
 /**
- * 阿里云 Rocket MQ 配置类
+ * 阿里云 Rocket MQ 自动配置类
  *
  * @author ThierrySquirrel
  * @author Uncarbon
  */
 @RequiredArgsConstructor
 @EnableConfigurationProperties(value = {AliyunRocketProperties.class})
-@Configuration
+@AutoConfiguration
 public class AliyunRocketAutoConfiguration {
 
     private final AliyunRocketProperties rocketProperties;
-
     private final Map<String, Object> consumerContainer;
-
     private final RocketSerializer rocketSerializer;
 
 

+ 0 - 2
helio-starter-rocketmq-aliyun/src/main/resources/META-INF/spring.factories

@@ -1,2 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.rocketmq.config.AliyunRocketAutoConfiguration

+ 1 - 0
helio-starter-rocketmq-aliyun/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1 @@
+cc.uncarbon.framework.rocketmq.config.AliyunRocketAutoConfiguration

+ 0 - 1
helio-starter-seata/src/main/resources/META-INF/spring.factories

@@ -1 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=

+ 0 - 0
helio-starter-seata/src/main/resources/PLACEHOLDER


+ 5 - 4
helio-starter-tenant/src/main/java/cc/uncarbon/framework/tenant/config/HelioTenantAutoConfiguration.java

@@ -6,15 +6,16 @@ import cc.uncarbon.framework.crud.support.impl.DefaultTenantSupport;
 import cc.uncarbon.framework.tenant.support.TenantDataSourceSupport;
 import cc.uncarbon.framework.tenant.support.TenantLineSupport;
 import lombok.RequiredArgsConstructor;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.support.GenericApplicationContext;
 
 /**
  * Helio 多租户自动配置类
  * 当启用多租户功能,且多租户隔离级别配置正确,则向 IoC 容器注入对应处理 Bean
+ *
+ * @author Uncarbon
  */
-@Configuration
+@AutoConfiguration
 @RequiredArgsConstructor
 public class HelioTenantAutoConfiguration {
 
@@ -22,7 +23,7 @@ public class HelioTenantAutoConfiguration {
 
 
     @Bean
-    public TenantSupport tenantSupport(GenericApplicationContext applicationContext) {
+    public TenantSupport tenantSupport() {
         if (!Boolean.TRUE.equals(helioProperties.getTenant().getEnabled())) {
             // 引入了 starter,但未启用多租户
             return new DefaultTenantSupport();

+ 0 - 2
helio-starter-tenant/src/main/resources/META-INF/spring.factories

@@ -1,2 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.tenant.config.HelioTenantAutoConfiguration

+ 1 - 0
helio-starter-tenant/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1 @@
+cc.uncarbon.framework.tenant.config.HelioTenantAutoConfiguration

+ 0 - 1
helio-starter-test/src/main/resources/META-INF/spring.factories

@@ -1 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=

+ 0 - 0
helio-starter-test/src/main/resources/PLACEHOLDER


+ 12 - 7
helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/AdviceExceptionAutoConfiguration.java

@@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Configuration;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
@@ -24,16 +24,18 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
 import org.springframework.web.servlet.NoHandlerFoundException;
 
 /**
- * Web全局异常处理
+ * Web 全局异常处理自动配置类
+ *
  * @author Uncarbon
  */
 @Slf4j
 @RestController
 @ControllerAdvice
-@Configuration
+@AutoConfiguration
 public class AdviceExceptionAutoConfiguration {
 
     protected static final MediaType MEDIA_TYPE = new MediaType("application", "json", StandardCharsets.UTF_8);
@@ -102,18 +104,21 @@ public class AdviceExceptionAutoConfiguration {
      *
      * IllegalArgumentException
      * 不合法的参数异常
+     *
+     * MethodArgumentTypeMismatchException
+     * "@PathVariable" 注解收参类型为 Long,但传的是 String
      */
     @ResponseStatus(HttpStatus.BAD_REQUEST)
-    @ExceptionHandler({JsonParseException.class, HttpMessageNotReadableException.class, IllegalArgumentException.class})
+    @ExceptionHandler({JsonParseException.class, HttpMessageNotReadableException.class, IllegalArgumentException.class, MethodArgumentTypeMismatchException.class})
     public ResponseEntity<ApiResult<?>> handleJsonParseException(Exception e, HttpServletRequest request) {
         this.logError(e, request);
-        ApiResult<?> ret = ApiResult.fail(HttpStatus.NOT_ACCEPTABLE.value(), "错误参数格式或值(如应该输入整数的部分填写了其他内容,或超过枚举值限制)");
+        ApiResult<?> ret = ApiResult.fail(HttpStatus.NOT_ACCEPTABLE.value(), "错误参数格式或值");
         return createResponseEntity(HttpStatus.BAD_REQUEST, ret);
     }
 
     /**
-     * JSR303 表单参数校验失败
-     * 需在Controller层使用@Valid注解
+     * JSR303 表单参数校验失败,或入参格式转换失败
+     * 需在 Controller 层使用@Valid注解
      */
     @ResponseStatus(HttpStatus.BAD_REQUEST)
     @ExceptionHandler({MethodArgumentNotValidException.class, BindException.class})

+ 3 - 3
helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/DefaultWebMvcAutoConfiguration.java

@@ -3,7 +3,7 @@ package cc.uncarbon.framework.web.config;
 import cc.uncarbon.framework.web.jackson.EnumConverterFactory;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.propertyeditors.StringTrimmerEditor;
-import org.springframework.context.annotation.Configuration;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.format.FormatterRegistry;
 import org.springframework.web.bind.WebDataBinder;
 import org.springframework.web.bind.support.WebBindingInitializer;
@@ -11,12 +11,12 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 /**
- * 默认WebMVC配置
+ * 默认 WebMVC 行为自动配置
  *
  * @author Uncarbon
  **/
 @Slf4j
-@Configuration
+@AutoConfiguration
 public class DefaultWebMvcAutoConfiguration implements WebMvcConfigurer, WebBindingInitializer {
     /**
      * 自定义静态资源

+ 7 - 8
helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/JacksonExtendAutoConfiguration.java

@@ -11,28 +11,27 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import java.text.SimpleDateFormat;
+import java.time.ZoneId;
+import java.util.Locale;
+import java.util.TimeZone;
+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;
 
-import java.text.SimpleDateFormat;
-import java.time.ZoneId;
-import java.util.Locale;
-import java.util.TimeZone;
-
 /**
- * Jackson配置类
+ * Jackson 自动配置类
  *
  * @author Zhu JW
  * @author Uncarbon
  */
 @ConditionalOnClass(ObjectMapper.class)
 @AutoConfigureBefore({JacksonAutoConfiguration.class})
-@Configuration
+@AutoConfiguration
 public class JacksonExtendAutoConfiguration {
 
     @Bean

+ 13 - 9
helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/MessageConverterAutoConfiguration.java

@@ -1,26 +1,30 @@
 package cc.uncarbon.framework.web.config;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-import lombok.AllArgsConstructor;
-import org.springframework.context.annotation.Configuration;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.core.Ordered;
 import org.springframework.core.annotation.Order;
-import org.springframework.http.converter.*;
+import org.springframework.http.converter.ByteArrayHttpMessageConverter;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.ResourceHttpMessageConverter;
+import org.springframework.http.converter.ResourceRegionHttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
 import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-
 /**
- * Jackson类型转换器配置
+ * Jackson 类型转换器自动配置类
  *
  * @author Zhu JW
+ * @author Uncarbon
  **/
-@AllArgsConstructor
+@RequiredArgsConstructor
 @Order(Ordered.HIGHEST_PRECEDENCE)
-@Configuration
+@AutoConfiguration
 public class MessageConverterAutoConfiguration implements WebMvcConfigurer {
 
     private final ObjectMapper objectMapper;

+ 3 - 3
helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/XssAutoConfiguration.java

@@ -2,17 +2,17 @@ package cc.uncarbon.framework.web.config;
 
 import cc.uncarbon.framework.web.xss.XssFilter;
 import javax.servlet.DispatcherType;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.web.servlet.FilterRegistrationBean;
 import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
 
 /**
- * 反XSS注入
+ * 反 XSS 注入自动配置类
  *
  * @author Uncarbon
  */
-@Configuration
+@AutoConfiguration
 public class XssAutoConfiguration {
 
     @Bean

+ 2 - 5
helio-starter-web/src/main/java/cc/uncarbon/framework/web/model/response/ApiResult.java

@@ -4,30 +4,27 @@ import cc.uncarbon.framework.core.constant.HelioConstant;
 import cc.uncarbon.framework.core.enums.HelioBaseEnum;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.http.HttpStatus;
-import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
-import lombok.experimental.SuperBuilder;
 
 import java.io.Serializable;
 
 /**
  * HTTP接口通用返回对象
+ *
  * @author Uncarbon
  */
-@ApiModel(value = "HTTP接口通用返回对象")
 @Accessors(chain = true)
-@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
 public class ApiResult<T> implements Serializable {
 
     @ApiModelProperty(value = "状态码")
-    private Integer code;
+    private int code;
 
     @ApiModelProperty(value = "返回消息")
     private String msg;

+ 49 - 6
helio-starter-web/src/main/java/cc/uncarbon/framework/web/util/InvalidFieldUtil.java

@@ -1,9 +1,8 @@
 package cc.uncarbon.framework.web.util;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import io.swagger.annotations.ApiModelProperty;
-import java.util.ArrayList;
-import java.util.List;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -12,6 +11,12 @@ import lombok.experimental.UtilityClass;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.FieldError;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+
 /**
  * 参数绑定验证
  *
@@ -21,11 +26,26 @@ import org.springframework.validation.FieldError;
 @UtilityClass
 public class InvalidFieldUtil {
 
+    /**
+     * 特定关键词时-指定文案映射关系
+     * 使用 public 修饰符以支持外部变更
+     */
+    public final Map<String, String> MESSAGE_MASKING_MAPPER = new ConcurrentHashMap<>(16);
+
+    static {
+        /*
+        完整的默认消息
+        Failed to convert property value of type 'java.lang.String' to required type 'java.time.LocalDateTime' for property 'beginAt'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@com.fasterxml.jackson.annotation.JsonFormat @io.swagger.annotations.ApiModelProperty @org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime] for value '2022-08-18'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [2022-08-18]
+         */
+        MESSAGE_MASKING_MAPPER.put("Failed to convert property value of type", "错误参数格式或值");
+    }
+
     /**
      * 参数绑定验证
+     *
      * @return 快速返回首个无效表单项
      */
-    public static InvalidField getInvalidField(BindingResult bindingResult) {
+    public InvalidField getInvalidField(BindingResult bindingResult) {
         if (bindingResult == null) {
             return null;
         }
@@ -37,15 +57,16 @@ public class InvalidFieldUtil {
 
         return InvalidField.builder()
                 .fieldName(fieldError.getField())
-                .message(fieldError.getDefaultMessage())
+                .message(maskMessage(fieldError.getDefaultMessage()))
                 .build();
     }
 
     /**
      * 参数绑定验证
+     *
      * @return 全量返回无效表单项
      */
-    public static List<InvalidField> listInvalidField(BindingResult bindingResult) {
+    public List<InvalidField> listInvalidField(BindingResult bindingResult) {
         List<InvalidField> invalidFieldList = new ArrayList<>();
         if (bindingResult == null || CollUtil.isEmpty(bindingResult.getFieldErrors())) {
             // 返回空List
@@ -56,7 +77,7 @@ public class InvalidFieldUtil {
         for (FieldError fieldError : fieldErrorList) {
             InvalidField invalidField = new InvalidField();
             invalidField.setFieldName(fieldError.getField());
-            invalidField.setMessage(fieldError.getDefaultMessage());
+            invalidField.setMessage(maskMessage(fieldError.getDefaultMessage()));
             invalidFieldList.add(invalidField);
         }
 
@@ -77,4 +98,26 @@ public class InvalidFieldUtil {
 
     }
 
+    /**
+     * 为了避免详细的报错消息文本暴露给前端,当存在特定关键词时,使用指定文案返回
+     *
+     * @param defaultMessage 消息文本
+     * @return 指定文案
+     */
+    private String maskMessage(String defaultMessage) {
+        // corner case
+        if (defaultMessage == null) {
+            return StrUtil.EMPTY;
+        }
+
+        for (Entry<String, String> entry : MESSAGE_MASKING_MAPPER.entrySet()) {
+            if (defaultMessage.contains(entry.getKey())) {
+                return entry.getValue();
+            }
+        }
+
+        // 原样返回
+        return defaultMessage;
+    }
+
 }

+ 0 - 7
helio-starter-web/src/main/resources/META-INF/spring.factories

@@ -1,7 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.web.listener.LaunchEventListener,\
-  cc.uncarbon.framework.web.config.DefaultWebMvcAutoConfiguration,\
-  cc.uncarbon.framework.web.config.AdviceExceptionAutoConfiguration,\
-  cc.uncarbon.framework.web.config.JacksonExtendAutoConfiguration,\
-  cc.uncarbon.framework.web.config.MessageConverterAutoConfiguration,\
-  cc.uncarbon.framework.web.config.XssAutoConfiguration

+ 6 - 0
helio-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -0,0 +1,6 @@
+cc.uncarbon.framework.web.listener.LaunchEventListener
+cc.uncarbon.framework.web.config.DefaultWebMvcAutoConfiguration
+cc.uncarbon.framework.web.config.AdviceExceptionAutoConfiguration
+cc.uncarbon.framework.web.config.JacksonExtendAutoConfiguration
+cc.uncarbon.framework.web.config.MessageConverterAutoConfiguration
+cc.uncarbon.framework.web.config.XssAutoConfiguration

+ 5 - 4
helio-starter-web/src/main/resources/application.yml

@@ -1,7 +1,8 @@
 spring:
   mvc:
-    #出现错误时, 直接抛出异常
+    # 出现错误时, 直接抛出异常
     throw-exception-if-no-handler-found: true
-  #不为工程中的资源文件建立映射
-  resources:
-    add-mappings: false
+  # 不为工程中的资源文件建立映射
+  web:
+    resources:
+      add-mappings: false

+ 9 - 9
pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.7.1</version>
+        <version>2.7.3</version>
         <relativePath/>
     </parent>
 
@@ -33,38 +33,38 @@
 
     <properties>
         <!-- core versions -->
-        <revision>1.6.0</revision>
+        <revision>1.7.0</revision>
         <helio-starters.version>${revision}</helio-starters.version>
         <!-- JDK8则改为'1.8'  JDK11则改为'11' -->
         <java.version>1.8</java.version>
         <!-- 若变更Spring Boot版本, 上面parent依赖版本也要变 -->
-        <spring-boot.version>2.7.1</spring-boot.version>
+        <spring-boot.version>2.7.3</spring-boot.version>
 
 
         <!-- Spring Cloud versions -->
         <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-dependencies -->
-        <spring-cloud.version>2021.0.1</spring-cloud.version>
+        <spring-cloud.version>2021.0.3</spring-cloud.version>
         <spring-cloud-starter-bootstrap.version>3.0.3</spring-cloud-starter-bootstrap.version>
 
         <!-- Spring Cloud Alibaba versions -->
         <spring-cloud-alibaba.version>2021.0.1.0</spring-cloud-alibaba.version>
-        <dubbo.version>3.0.9</dubbo.version>
+        <dubbo.version>3.1.0</dubbo.version>
         <seata.vesion>1.4.2</seata.vesion>
-        <nacos-client.vesion>2.1.0</nacos-client.vesion>
+        <nacos-client.vesion>2.1.1</nacos-client.vesion>
 
 
         <!-- 3rd-party versions -->
-        <hutool.version>5.8.4</hutool.version>
+        <hutool.version>5.8.5</hutool.version>
         <sa-token.version>1.30.0</sa-token.version>
         <transmittable-thread-local.version>2.12.1</transmittable-thread-local.version>
         <!-- 如果 mp 较新版存在问题,可以回退至 3.4.3.4 试试  -->
         <mybatis-plus.version>3.5.2</mybatis-plus.version>
         <knife4j.version>3.0.3</knife4j.version>
-        <redisson.version>3.16.7</redisson.version>
+        <redisson.version>3.17.6</redisson.version>
         <aspectj.version>1.9.6</aspectj.version>
         <ons-client.version>1.8.8.1.Final</ons-client.version>
         <guava.version>31.1-jre</guava.version>
-        <mybatis-plus-dynamic-datasource.version>3.5.1</mybatis-plus-dynamic-datasource.version>
+        <mybatis-plus-dynamic-datasource.version>3.5.2</mybatis-plus-dynamic-datasource.version>
 
 
         <!-- DB Driver versions -->