소스 검색

feat: 发布1.4.0

Uncarbon 4 년 전
부모
커밋
9197a7ab2a
35개의 변경된 파일475개의 추가작업 그리고 216개의 파일을 삭제
  1. 3 1
      README.md
  2. 22 3
      helio-core/pom.xml
  3. 2 0
      helio-core/src/main/java/cc/uncarbon/framework/core/context/UserContext.java
  4. 113 53
      helio-core/src/main/java/cc/uncarbon/framework/core/enums/HelioBaseEnum.java
  5. 4 0
      helio-core/src/main/java/cc/uncarbon/framework/core/exception/BusinessException.java
  6. 3 3
      helio-core/src/main/java/cc/uncarbon/framework/core/page/PageParam.java
  7. 6 6
      helio-core/src/main/java/cc/uncarbon/framework/core/page/PageResult.java
  8. 2 2
      helio-starter-aop/pom.xml
  9. 3 3
      helio-starter-cloud/pom.xml
  10. 2 2
      helio-starter-crud/pom.xml
  11. 1 1
      helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/HelioMybatisPlusAutoConfiguration.java
  12. 5 10
      helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/entity/HelioBaseEntity.java
  13. 42 0
      helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/enums/YesOrNoEnum.java
  14. 1 1
      helio-starter-crud/src/main/resources/META-INF/spring.factories
  15. 2 2
      helio-starter-dubbo/pom.xml
  16. 8 9
      helio-starter-dubbo/src/main/java/cc/uncarbon/framework/dubbo/filter/ConsumerContextFilter.java
  17. 68 59
      helio-starter-dubbo/src/main/java/cc/uncarbon/framework/dubbo/filter/HelioDubboExceptionFilter.java
  18. 9 4
      helio-starter-dubbo/src/main/java/cc/uncarbon/framework/dubbo/filter/ProviderContextFilter.java
  19. 2 2
      helio-starter-knife4j/pom.xml
  20. 4 3
      helio-starter-knife4j/src/main/java/cc/uncarbon/framework/knife4j/config/HelioKnife4jAutoConfiguration.java
  21. 85 0
      helio-starter-knife4j/src/main/java/cc/uncarbon/framework/knife4j/config/Knife4jEnumPropertyAutoConfiguration.java
  22. 2 1
      helio-starter-knife4j/src/main/resources/META-INF/spring.factories
  23. 2 2
      helio-starter-redis/pom.xml
  24. 2 2
      helio-starter-rocketmq-aliyun/pom.xml
  25. 2 2
      helio-starter-satoken/pom.xml
  26. 2 2
      helio-starter-seata/pom.xml
  27. 2 2
      helio-starter-test/pom.xml
  28. 2 2
      helio-starter-web/pom.xml
  29. 15 13
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/AdviceExceptionAutoConfiguration.java
  30. 5 4
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/DefaultWebMvcAutoConfiguration.java
  31. 2 0
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/enums/ErrorResponseEnum.java
  32. 5 1
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/model/request/IdsDTO.java
  33. 10 2
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/model/response/ApiResult.java
  34. 4 5
      helio-starter-web/src/main/java/cc/uncarbon/framework/web/util/InvalidFieldUtil.java
  35. 33 14
      pom.xml

+ 3 - 1
README.md

@@ -2,7 +2,9 @@
 
 ## 项目介绍
 
-`helio-starters`基于[JDK15](http://jdk.java.net/archive/),是Helio脚手架及其业务微服务模块的基础支撑构件,可以快速引入其他中间件和基础配置
+`helio-starters`是Helio脚手架及其业务微服务模块的基础支撑构件,可以快速引入其他中间件和基础配置
+
+JDK compatibility: 1.8 - 17
 
 [官方文档](https://helio.uncarbon.cc/)
 [主要依赖](https://helio.uncarbon.cc/#/i18n/zh-CN/helio-starters/dependencies)

+ 22 - 3
helio-core/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -17,41 +17,60 @@
     </properties>
 
     <dependencies>
+        <!-- Spring Boot starter -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter</artifactId>
+            <exclusions>
+                <!-- 排除 Log4j 门面层 -->
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-to-slf4j</artifactId>
+                </exclusion>
+
+                <!-- 排除 jul 门面层 -->
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>jul-to-slf4j</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
+        <!-- Spring 自动配置处理器 -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-configuration-processor</artifactId>
-            <optional>true</optional>
         </dependency>
 
+        <!-- Jackson 注解包 -->
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-annotations</artifactId>
         </dependency>
 
+        <!-- javax validation 注解包 -->
         <dependency>
             <groupId>javax.validation</groupId>
             <artifactId>validation-api</artifactId>
         </dependency>
 
+        <!-- TTL -->
         <dependency>
             <groupId>com.alibaba</groupId>
             <artifactId>transmittable-thread-local</artifactId>
         </dependency>
 
+        <!-- hutool yyds! -->
         <dependency>
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-all</artifactId>
         </dependency>
 
+        <!-- knife4j 注解包 -->
         <dependency>
             <groupId>com.github.xiaoymin</groupId>
             <artifactId>knife4j-annotations</artifactId>
         </dependency>
     </dependencies>
 
-</project>
+</project>

+ 2 - 0
helio-core/src/main/java/cc/uncarbon/framework/core/context/UserContext.java

@@ -26,6 +26,8 @@ public class UserContext implements Serializable {
 
     private static final long SerialVersionUID = 1L;
 
+    public static final String CAMEL_NAME = "userContext";
+
     @ApiModelProperty(value = "用户ID")
     private Long userId;
 

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

@@ -1,11 +1,14 @@
 package cc.uncarbon.framework.core.enums;
 
 import cc.uncarbon.framework.core.exception.BusinessException;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
-import org.springframework.lang.Nullable;
+import cn.hutool.core.util.StrUtil;
 
 import java.io.Serializable;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Optional;
 import java.util.function.Predicate;
 
@@ -17,57 +20,6 @@ import java.util.function.Predicate;
  **/
 public interface HelioBaseEnum<T> extends Serializable {
 
-    /**
-     * 枚举选项的值,通常由字母或者数字组成,并且在同一个枚举中值唯一;对应数据库中的值通常也为此值
-     *
-     * @return 枚举的值
-     */
-    T getValue();
-
-    /**
-     * 枚举选项的文本,通常为中文
-     *
-     * @return 枚举的文本
-     */
-    String getLabel();
-
-    /**
-     * 断言不为空
-     * 注意:枚举选项的值value需要为Integer类型
-     * @param object 需要判断的对象
-     */
-    default void assertNotNull(@Nullable Object object) {
-        if (ObjectUtil.isNull(object)) {
-            if (this.getValue() instanceof Integer) {
-                throw new BusinessException((Integer) this.getValue(), this.getLabel());
-            }
-
-            throw new UnsupportedOperationException("枚举选项的值value需要为Integer类型");
-        }
-    }
-
-    /**
-     * 对比是否和value相等,对比地址,值,value转为string忽略大小写对比,text忽略大小写对比
-     *
-     * @param v value
-     * @return 是否相等
-     */
-    @SuppressWarnings("all")
-    default boolean eq(Object v) {
-        if (v == null) {
-            return false;
-        }
-        if (v instanceof Object[]) {
-            v = Arrays.asList(v);
-        }
-        return this == v
-                || getValue() == v
-                || getValue().equals(v)
-                || String.valueOf(getValue()).equalsIgnoreCase(String.valueOf(v))
-                || getLabel().equalsIgnoreCase(String.valueOf(v)
-        );
-    }
-
     /**
      * 从指定的枚举类中查找想要的枚举,并返回一个{@link Optional},如果未找到,则返回一个{@link Optional#empty()}
      *
@@ -114,7 +66,6 @@ public interface HelioBaseEnum<T> extends Serializable {
         return find(type, v -> v.eq(target));
     }
 
-
     static <E extends HelioBaseEnum<?>> Optional<E> of(Class<E> type, Object value) {
         if (type.isEnum()) {
             for (E enumConstant : type.getEnumConstants()) {
@@ -126,4 +77,113 @@ public interface HelioBaseEnum<T> extends Serializable {
         }
         return Optional.empty();
     }
+
+    /**
+     * 枚举选项的值,通常由字母或者数字组成,并且在同一个枚举中值唯一;对应数据库中的值通常也为此值
+     *
+     * @return 枚举的值
+     */
+    T getValue();
+
+    /**
+     * 枚举选项的文本,通常为中文
+     *
+     * @return 枚举的文本
+     */
+    String getLabel();
+
+    /**
+     * 对比是否和value相等,对比地址,值,value转为string忽略大小写对比,text忽略大小写对比
+     *
+     * @param v value
+     * @return 是否相等
+     */
+    @SuppressWarnings("all")
+    default boolean eq(Object v) {
+        if (v == null) {
+            return false;
+        }
+        if (v instanceof Object[]) {
+            v = Arrays.asList(v);
+        }
+        return this == v
+                || getValue() == v
+                || getValue().equals(v)
+                || String.valueOf(getValue()).equalsIgnoreCase(String.valueOf(v))
+                || getLabel().equalsIgnoreCase(String.valueOf(v)
+        );
+    }
+
+    /**
+     * 将不定类型的 value 统一转换为 int
+     * 按常见的数据类型依次判断,提高命中率
+     *
+     * @return int value
+     */
+    default int convertValue2Int() {
+        if (this.getValue() == null) {
+            throw new IllegalArgumentException("枚举类的 value 不能为 null !");
+        }
+
+        if (this.getValue() instanceof Integer) {
+            return (Integer) this.getValue();
+        }
+
+        if (this.getValue() instanceof Long) {
+            return ((Long) this.getValue()).intValue();
+        }
+
+        if (this.getValue() instanceof Number) {
+            return ((Number) this.getValue()).intValue();
+        }
+
+        if (this.getValue() instanceof String) {
+            return NumberUtil.toBigDecimal((String) this.getValue()).intValue();
+        }
+
+        throw new IllegalArgumentException("枚举类的 value 不能自动转换为 int !");
+    }
+
+    /**
+     * 断言不为null
+     * 注意:枚举选项的 value 建议为整数类型
+     *
+     * @param object 需要判断的对象
+     */
+    default void assertNotNull(Object object) {
+        if (ObjectUtil.isNotNull(object)) {
+            return;
+        }
+
+        throw new BusinessException(this.convertValue2Int(), this.getLabel());
+    }
+
+    /**
+     * 断言不为空文本
+     * 注意:枚举选项的 value 建议为整数类型
+     *
+     * @param str 需要判断的对象
+     */
+    default void assertNotBlank(CharSequence str) {
+        if (StrUtil.isNotBlank(str)) {
+            return;
+        }
+
+        throw new BusinessException(this.convertValue2Int(), this.getLabel());
+    }
+
+    /**
+     * 断言不为空列表
+     * 注意:枚举选项的 value 建议为整数类型
+     *
+     * @param list 需要判断的对象
+     */
+    default void assertNotEmpty(Collection<?> list) {
+        if (CollUtil.isNotEmpty(list)) {
+            return;
+        }
+
+        throw new BusinessException(this.convertValue2Int(), this.getLabel());
+    }
+
 }

+ 4 - 0
helio-core/src/main/java/cc/uncarbon/framework/core/exception/BusinessException.java

@@ -4,8 +4,11 @@ import cc.uncarbon.framework.core.enums.HelioBaseEnum;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 
+import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
+
 /**
  * 业务异常类
+ *
  * @author Uncarbon
  */
 @NoArgsConstructor
@@ -16,6 +19,7 @@ public class BusinessException extends RuntimeException {
 
     public BusinessException(String msg) {
         super(msg);
+        this.code = HTTP_INTERNAL_ERROR;
     }
 
     public BusinessException(int code, String msg) {

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

@@ -16,16 +16,16 @@ import java.io.Serializable;
  */
 @ApiModel(value = "分页查询参数")
 @Accessors(chain = true)
-@SuperBuilder(toBuilder = true)
+@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
 public class PageParam implements Serializable {
 
-    @ApiModelProperty("页码")
+    @ApiModelProperty(value = "当前页码")
     private Integer pageNum = 1;
 
-    @ApiModelProperty("页大小")
+    @ApiModelProperty(value = "当前页大小")
     private Integer pageSize = 10;
 
 }

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

@@ -17,22 +17,22 @@ import java.util.List;
  */
 @ApiModel(value = "分页查询结果")
 @Accessors(chain = true)
-@SuperBuilder(toBuilder = true)
+@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
-public class PageResult<T> implements Serializable {
+public class PageResult<T extends Serializable> implements Serializable {
 
-    @ApiModelProperty("当前页")
+    @ApiModelProperty(value = "当前页")
     private int current;
 
-    @ApiModelProperty("当前页数量")
+    @ApiModelProperty(value = "当前页数量")
     private int size;
 
-    @ApiModelProperty("总量")
+    @ApiModelProperty(value = "总量")
     private int total;
 
-    @ApiModelProperty("记录")
+    @ApiModelProperty(value = "记录")
     private List<T> records;
 
 }

+ 2 - 2
helio-starter-aop/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -27,4 +27,4 @@
             <artifactId>aspectjweaver</artifactId>
         </dependency>
     </dependencies>
-</project>
+</project>

+ 3 - 3
helio-starter-cloud/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -46,7 +46,7 @@
         <dependency>
             <groupId>com.alibaba.nacos</groupId>
             <artifactId>nacos-client</artifactId>
-            <version>2.0.0-BETA</version>
+            <version>${nacos-client.vesion}</version>
         </dependency>
     </dependencies>
-</project>
+</project>

+ 2 - 2
helio-starter-crud/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -46,4 +46,4 @@
             <artifactId>sqljdbc4</artifactId>
         </dependency>
     </dependencies>
-</project>
+</project>

+ 1 - 1
helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/MybatisPlusAutoConfiguration.java → helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/config/HelioMybatisPlusAutoConfiguration.java

@@ -26,7 +26,7 @@ import javax.annotation.Resource;
         proxyTargetClass = true
 )
 @Configuration
-public class MybatisPlusAutoConfiguration {
+public class HelioMybatisPlusAutoConfiguration {
 
     @Resource
     private HelioProperties helioProperties;

+ 5 - 10
helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/entity/HelioBaseEntity.java

@@ -15,14 +15,16 @@ import java.io.Serializable;
 import java.time.LocalDateTime;
 
 /**
+ * 基础实体类
+ *
  * @author Uncarbon
  */
 @Accessors(chain = true)
-@SuperBuilder(toBuilder = true)
+@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
-public abstract class HelioBaseEntity<PK> implements Serializable {
+public abstract class HelioBaseEntity<PK extends Serializable> implements Serializable {
 
     /**
      * 主键ID
@@ -42,7 +44,7 @@ public abstract class HelioBaseEntity<PK> implements Serializable {
      * 乐观锁
      * 需自行加@Version注解才有效
      */
-    @ApiModelProperty(value = "乐观锁(需自行加@Version注解才有效)")
+    @ApiModelProperty(value = "乐观锁", notes = "需再次复制本字段,并自行加 @Version 注解才有效")
     @TableField(value = "revision")
     private Long revision;
 
@@ -86,11 +88,4 @@ public abstract class HelioBaseEntity<PK> implements Serializable {
     @TableField(value = HelioConstant.CRUD.COLUMN_UPDATED_BY, fill = FieldFill.INSERT_UPDATE)
     private String updatedBy;
 
-    /**
-     * 备注
-     */
-    @ApiModelProperty(value = "备注")
-    @TableField(value = "remark")
-    private String remark;
-
 }

+ 42 - 0
helio-starter-crud/src/main/java/cc/uncarbon/framework/crud/enums/YesOrNoEnum.java

@@ -0,0 +1,42 @@
+package cc.uncarbon.framework.crud.enums;
+
+
+import cc.uncarbon.framework.core.enums.HelioBaseEnum;
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum YesOrNoEnum implements HelioBaseEnum<Integer> {
+
+    YES(1, "是"),
+
+    NO(0, "否"),
+
+    ;
+
+    @EnumValue
+    private final Integer value;
+    private final String label;
+
+    /**
+     * 取反值
+     * @param old 原值
+     * @return 新值
+     */
+    public static YesOrNoEnum reverse(YesOrNoEnum old) {
+        if (old == null) {
+            return null;
+        }
+
+        switch (old) {
+            case YES:
+                return NO;
+            case NO:
+                return YES;
+        }
+
+        throw new IllegalArgumentException();
+    }
+}

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

@@ -1,2 +1,2 @@
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-  cc.uncarbon.framework.crud.config.MybatisPlusAutoConfiguration
+  cc.uncarbon.framework.crud.config.HelioMybatisPlusAutoConfiguration

+ 2 - 2
helio-starter-dubbo/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -27,4 +27,4 @@
             <artifactId>dubbo-spring-boot-starter</artifactId>
         </dependency>
     </dependencies>
-</project>
+</project>

+ 8 - 9
helio-starter-dubbo/src/main/java/cc/uncarbon/framework/dubbo/filter/ConsumerContextFilter.java

@@ -6,10 +6,12 @@ import cn.hutool.json.JSONUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.constants.CommonConstants;
 import org.apache.dubbo.common.extension.Activate;
-import org.apache.dubbo.rpc.*;
-
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
 
 /**
  * 自定义Dubbo消费者上下文
@@ -23,15 +25,12 @@ public class ConsumerContextFilter implements Filter {
 
     @Override
     public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
-        Map<String, String> context = new HashMap<>(16);
-
         UserContext userContext = UserContextHolder.getUserContext();
         String userContextJson = JSONUtil.toJsonStr(userContext);
-        context.put("userContext", userContextJson);
-        log.debug("[Dubbo RPC] 设置当前用户上下文 >> {}", userContextJson);
 
         // 放进Dubbo消费者附件中
-        RpcContext.getContext().setAttachments(context);
+        log.debug("[Dubbo RPC] 设置当前用户上下文 >> {}", userContextJson);
+        RpcContext.getContext().setAttachment(UserContext.CAMEL_NAME, userContextJson);
 
         return invoker.invoke(invocation);
     }

+ 68 - 59
helio-starter-dubbo/src/main/java/cc/uncarbon/framework/dubbo/filter/HelioDubboExceptionFilter.java

@@ -2,13 +2,17 @@ package cc.uncarbon.framework.dubbo.filter;
 
 import cc.uncarbon.framework.core.exception.BusinessException;
 import cn.hutool.core.util.StrUtil;
+import java.lang.reflect.Method;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.utils.ReflectUtils;
-import org.apache.dubbo.rpc.*;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.ListenableFilter;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
 import org.apache.dubbo.rpc.service.GenericService;
 
-import java.lang.reflect.Method;
-
 /**
  * 自定义Dubbo异常处理
  *
@@ -30,77 +34,82 @@ public class HelioDubboExceptionFilter extends ListenableFilter {
     }
 
     static class ExceptionListener implements Listener {
-
         @Override
         public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
-            if (appResponse.hasException() && GenericService.class != invoker.getInterface()) {
-                try {
-                    Throwable exception = appResponse.getException();
+            if (!(
+                    appResponse.hasException() && GenericService.class != invoker.getInterface()
+            )) {
+                return;
+            }
 
-                    // directly throw if it's checked exception
-                    if (!(exception instanceof RuntimeException) && (exception instanceof Exception)) {
-                        return;
-                    }
-                    // directly throw if the exception appears in the signature
-                    try {
-                        Method method = invoker.getInterface().getMethod(invocation.getMethodName(), invocation.getParameterTypes());
-                        Class<?>[] exceptionClasses = method.getExceptionTypes();
-                        for (Class<?> exceptionClass : exceptionClasses) {
-                            if (exception.getClass().equals(exceptionClass)) {
-                                return;
-                            }
-                        }
-                    } catch (NoSuchMethodException e) {
-                        return;
-                    }
+            try {
+                Throwable exception = appResponse.getException();
 
-                    // for the exception not found in method's signature, print ERROR message in server's log.
-                    log.error("Got unchecked and undeclared exception which called by {}. service: {}, method: {}, exception: {} >> {}",
-                            RpcContext.getContext().getRemoteHost(),
-                            invoker.getInterface().getName(),
-                            invocation.getMethodName(),
-                            exception.getClass().getName(),
-                            exception.getMessage(),
-                            exception);
+                // directly throw if it's checked exception
+                if (!(exception instanceof RuntimeException) && (exception instanceof Exception)) {
+                    return;
+                }
 
-                    // directly throw if exception class and interface class are in the same jar file.
-                    String serviceFile = ReflectUtils.getCodeBase(invoker.getInterface());
-                    String exceptionFile = ReflectUtils.getCodeBase(exception.getClass());
-                    if (serviceFile == null || exceptionFile == null || serviceFile.equals(exceptionFile)) {
-                        return;
-                    }
-                    // directly throw if it's JDK exception
-                    String className = exception.getClass().getName();
-                    if (className.startsWith("java.") || className.startsWith("javax.")) {
-                        return;
-                    }
-                    // directly throw if it's dubbo exception
-                    if (exception instanceof RpcException) {
+                // directly throw if the exception appears in the signature
+                Method method = invoker.getInterface()
+                        .getMethod(invocation.getMethodName(), invocation.getParameterTypes());
+                Class<?>[] exceptionClasses = method.getExceptionTypes();
+                for (Class<?> exceptionClass : exceptionClasses) {
+                    if (exception.getClass().equals(exceptionClass)) {
                         return;
                     }
+                }
 
-                    // 业务异常
-                    if (className.contains(BUSINESS_EXCEPTION_SIMPLE_CLASS_NAME)) {
-                        return;
-                    }
+                // for the exception not found in method's signature, print ERROR message in server's log.
+                log.error(
+                        "Got unchecked and undeclared exception which called by {}. service: {}, method: {}, exception: {} >> {}",
+                        RpcContext.getContext().getRemoteHost(),
+                        invoker.getInterface().getName(),
+                        invocation.getMethodName(),
+                        exception.getClass().getName(),
+                        exception.getMessage(),
+                        exception);
 
-                    // otherwise, wrap with RuntimeException and throw back to the client
-                    appResponse.setException(new RuntimeException(StrUtil.toString(exception)));
-                } catch (Throwable e) {
-                    log.warn("Fail to ExceptionFilter when called by {}. service: {}, method: {}, exception: {} >> {}",
-                            RpcContext.getContext().getRemoteHost(),
-                            invoker.getInterface().getName(),
-                            invocation.getMethodName(),
-                            e.getClass().getName(),
-                            e.getMessage(),
-                            e);
+                // directly throw if exception class and interface class are in the same jar file.
+                String serviceFile = ReflectUtils.getCodeBase(invoker.getInterface());
+                String exceptionFile = ReflectUtils.getCodeBase(exception.getClass());
+                if (serviceFile == null || exceptionFile == null || serviceFile.equals(exceptionFile)) {
+                    return;
                 }
+                // directly throw if it's JDK exception
+                String className = exception.getClass().getName();
+                if (className.startsWith("java.") || className.startsWith("javax.")) {
+                    return;
+                }
+                // directly throw if it's dubbo exception
+                if (exception instanceof RpcException) {
+                    return;
+                }
+
+                // 业务异常
+                if (className.contains(BUSINESS_EXCEPTION_SIMPLE_CLASS_NAME)) {
+                    return;
+                }
+
+                // otherwise, wrap with RuntimeException and throw back to the client
+                appResponse.setException(new RuntimeException(StrUtil.toString(exception)));
+            } catch (NoSuchMethodException cause) {
+                // ignored
+            } catch (Throwable cause) {
+                log.warn("Fail to ExceptionFilter when called by {}. service: {}, method: {}, exception: {} >> {}",
+                        RpcContext.getContext().getRemoteHost(),
+                        invoker.getInterface().getName(),
+                        invocation.getMethodName(),
+                        cause.getClass().getName(),
+                        cause.getMessage(),
+                        cause);
             }
         }
 
         @Override
         public void onError(Throwable e, Invoker<?> invoker, Invocation invocation) {
-            log.error("Got unchecked and undeclared exception which called by {}. service: {}, method: {}, exception: {} >> {}",
+            log.error(
+                    "Got unchecked and undeclared exception which called by {}. service: {}, method: {}, exception: {} >> {}",
                     RpcContext.getContext().getRemoteHost(),
                     invoker.getInterface().getName(),
                     invocation.getMethodName(),

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

@@ -2,12 +2,17 @@ package cc.uncarbon.framework.dubbo.filter;
 
 import cc.uncarbon.framework.core.context.UserContext;
 import cc.uncarbon.framework.core.context.UserContextHolder;
-import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.constants.CommonConstants;
 import org.apache.dubbo.common.extension.Activate;
-import org.apache.dubbo.rpc.*;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
 
 /**
  * 自定义Dubbo提供者上下文
@@ -21,8 +26,8 @@ public class ProviderContextFilter implements Filter {
 
     @Override
     public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
-        String userContextJson = RpcContext.getContext().getAttachment("userContext");
-        if (CharSequenceUtil.isNotEmpty(userContextJson)) {
+        String userContextJson = RpcContext.getContext().getAttachment(UserContext.CAMEL_NAME);
+        if (StrUtil.isNotEmpty(userContextJson)) {
             UserContext userContext = JSONUtil.parseObj(userContextJson).toBean(UserContext.class);
             UserContextHolder.setUserContext(userContext);
             log.debug("[Dubbo RPC] 获取当前用户上下文 >> {}", userContextJson);

+ 2 - 2
helio-starter-knife4j/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -32,4 +32,4 @@
             <artifactId>knife4j-micro-spring-boot-starter</artifactId>
         </dependency>
     </dependencies>
-</project>
+</project>

+ 4 - 3
helio-starter-knife4j/src/main/java/cc/uncarbon/module/knife4j/config/Knife4jAutoConfiguration.java → helio-starter-knife4j/src/main/java/cc/uncarbon/framework/knife4j/config/HelioKnife4jAutoConfiguration.java

@@ -1,4 +1,4 @@
-package cc.uncarbon.module.knife4j.config;
+package cc.uncarbon.framework.knife4j.config;
 
 
 import cc.uncarbon.framework.core.props.HelioProperties;
@@ -28,8 +28,9 @@ import java.util.List;
 
 
 /**
- * knife4j自动配置类
+ * Helio knife4j 自动配置类
  * 参考http://events.jianshu.io/p/2f19c1863da0
+ *
  * @author Uncarbon
  * @author xiaoymin
  */
@@ -37,7 +38,7 @@ import java.util.List;
 @EnableKnife4j
 @Import(BeanValidatorPluginsConfiguration.class)
 @Configuration
-public class Knife4jAutoConfiguration {
+public class HelioKnife4jAutoConfiguration {
 
     @Value(value = "${sa-token.token-name:Authorization}")
     private String HEADER_TOKEN_NAME;

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

@@ -0,0 +1,85 @@
+package cc.uncarbon.framework.knife4j.config;
+
+import cc.uncarbon.framework.core.enums.HelioBaseEnum;
+import io.swagger.annotations.ApiModelProperty;
+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 文档生成枚举类描述
+ * 示例代码:
+ *     @ApiModelProperty(value = "性别")
+ *     private GenderEnum gender;
+ *
+ * 输出文档描述:
+ *     性别(0=未知 1=男 2=女)
+ *
+ * @author Demon-HY
+ * @author Uncarbon
+ */
+@ConditionalOnProperty(prefix = "knife4j", value = "production", havingValue = "false")
+@Component
+public class Knife4jEnumPropertyAutoConfiguration implements ModelPropertyBuilderPlugin {
+
+    @Override
+    public void apply(ModelPropertyContext context) {
+
+        Optional<ApiModelProperty> annotation = Optional.empty();
+        Class<?> rawPrimaryType = null;
+
+        if (context.getAnnotatedElement().isPresent()) {
+            annotation = ApiModelProperties.findApiModePropertyAnnotation(context.getAnnotatedElement().get());
+        }
+
+        if (context.getBeanPropertyDefinition().isPresent()) {
+            annotation = Annotations.findPropertyAnnotation(
+                    context.getBeanPropertyDefinition().get(),
+                    ApiModelProperty.class);
+
+            rawPrimaryType = context.getBeanPropertyDefinition().get().getRawPrimaryType();
+        }
+
+        // 过滤得到目标类型
+        if (annotation.isPresent() && rawPrimaryType != null && HelioBaseEnum.class.isAssignableFrom(rawPrimaryType)) {
+            // 获取枚举类中的所有枚举项
+            HelioBaseEnum<?>[] enumItems = (HelioBaseEnum<?>[]) rawPrimaryType.getEnumConstants();
+
+            /*
+            拼接描述字符串
+             */
+            StringBuilder newDescription = new StringBuilder(128)
+                    .append(annotation.get().value())
+                    .append("(")
+                    ;
+
+            for (int i = 0; i < enumItems.length; i++) {
+                newDescription
+                        .append(enumItems[i].getValue())
+                        .append("=")
+                        .append(enumItems[i].getLabel())
+                        ;
+
+                if (i < enumItems.length - 1) {
+                    // 不是最后一项,增加分割符
+                    newDescription.append(" ");
+                }
+            }
+            newDescription.append(")");
+
+            // 更新文档中的描述
+            context.getSpecificationBuilder().description(newDescription.toString());
+        }
+    }
+
+    @Override
+    public boolean supports(DocumentationType documentationType) {
+        return true;
+    }
+}

+ 2 - 1
helio-starter-knife4j/src/main/resources/META-INF/spring.factories

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

+ 2 - 2
helio-starter-redis/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -23,4 +23,4 @@
         </dependency>
     </dependencies>
 
-</project>
+</project>

+ 2 - 2
helio-starter-rocketmq-aliyun/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -38,4 +38,4 @@
         </dependency>
     </dependencies>
 
-</project>
+</project>

+ 2 - 2
helio-starter-satoken/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -39,4 +39,4 @@
 
     </dependencies>
 
-</project>
+</project>

+ 2 - 2
helio-starter-seata/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -22,4 +22,4 @@
             <artifactId>seata-spring-boot-starter</artifactId>
         </dependency>
     </dependencies>
-</project>
+</project>

+ 2 - 2
helio-starter-test/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -22,4 +22,4 @@
             <artifactId>spring-boot-starter-test</artifactId>
         </dependency>
     </dependencies>
-</project>
+</project>

+ 2 - 2
helio-starter-web/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>helio-starters</artifactId>
         <groupId>cc.uncarbon.framework</groupId>
-        <version>1.3.0</version>
+        <version>1.4.0</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
@@ -43,4 +43,4 @@
         </dependency>
     </dependencies>
 
-</project>
+</project>

+ 15 - 13
helio-starter-web/src/main/java/cc/uncarbon/framework/web/config/AdviceExceptionAutoConfiguration.java

@@ -8,6 +8,9 @@ import cn.dev33.satoken.exception.NotLoginException;
 import cn.dev33.satoken.exception.NotPermissionException;
 import cn.dev33.satoken.exception.NotRoleException;
 import com.fasterxml.jackson.core.JsonParseException;
+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.http.HttpStatus;
@@ -17,13 +20,12 @@ import org.springframework.http.converter.HttpMessageNotReadableException;
 import org.springframework.validation.BindException;
 import org.springframework.web.HttpRequestMethodNotSupportedException;
 import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.*;
+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.servlet.NoHandlerFoundException;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.nio.charset.StandardCharsets;
-
 /**
  * Web全局异常处理
  * @author Uncarbon
@@ -94,28 +96,28 @@ public class AdviceExceptionAutoConfiguration {
     }
 
     /**
-     * JsonParseException, HttpMessageNotReadableException,BindException
+     * JsonParseException, HttpMessageNotReadableException
      * Jackson反序列化异常
-     * 通常是因为JSON格式错误, 或枚举输入值超出范围
+     * 通常是因为JSON格式错误或枚举输入值超出范围
      *
      * IllegalArgumentException
      * 不合法的参数异常
      */
     @ResponseStatus(HttpStatus.BAD_REQUEST)
-    @ExceptionHandler({JsonParseException.class, HttpMessageNotReadableException.class, BindException.class, IllegalArgumentException.class})
+    @ExceptionHandler({JsonParseException.class, HttpMessageNotReadableException.class, IllegalArgumentException.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注解
+     * 在Controller层使用@Valid注解
      */
     @ResponseStatus(HttpStatus.BAD_REQUEST)
-    @ExceptionHandler({MethodArgumentNotValidException.class})
-    public ResponseEntity<ApiResult<?>> handleMethodArgumentNotValidException(MethodArgumentNotValidException e, HttpServletRequest request) {
+    @ExceptionHandler({MethodArgumentNotValidException.class, BindException.class})
+    public ResponseEntity<ApiResult<?>> handleBindException(BindException e, HttpServletRequest request) {
         this.logError(e, request);
         ApiResult<?> ret = ApiResult.fail(HttpStatus.NOT_ACCEPTABLE.value(), "错误参数格式或值", InvalidFieldUtil.getInvalidField(e.getBindingResult()));
         return createResponseEntity(HttpStatus.BAD_REQUEST, ret);
@@ -140,7 +142,7 @@ public class AdviceExceptionAutoConfiguration {
     @ExceptionHandler({Exception.class})
     public ResponseEntity<ApiResult<?>> handleException(Exception e, HttpServletRequest request) {
         this.logError(e, request);
-        // 打印堆栈, 方便溯源
+        // 打印堆栈方便溯源
         e.printStackTrace();
 
         int responseCode = HttpStatus.INTERNAL_SERVER_ERROR.value();

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

@@ -12,13 +12,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 /**
  * 默认WebMVC配置
+ *
  * @author Uncarbon
  **/
 @Slf4j
 @Configuration
 public class DefaultWebMvcAutoConfiguration implements WebMvcConfigurer, WebBindingInitializer {
     /**
-     * 资源处理器
+     * 自定义静态资源
      */
     @Override
     public void addResourceHandlers(ResourceHandlerRegistry registry) {
@@ -26,10 +27,10 @@ public class DefaultWebMvcAutoConfiguration implements WebMvcConfigurer, WebBind
                 .addResourceHandler("/static/**")
                 .addResourceLocations("classpath:/static/");
         registry
-                .addResourceHandler("doc.html")
+                .addResourceHandler("/doc.html")
                 .addResourceLocations("classpath:/META-INF/resources/");
         registry
-                .addResourceHandler("swagger-ui.html")
+                .addResourceHandler("/swagger-resources")
                 .addResourceLocations("classpath:/META-INF/resources/");
         registry
                 .addResourceHandler("/webjars/**")
@@ -51,4 +52,4 @@ public class DefaultWebMvcAutoConfiguration implements WebMvcConfigurer, WebBind
     public void addFormatters(FormatterRegistry registry) {
         registry.addConverterFactory(new EnumConverterFactory());
     }
-}
+}

+ 2 - 0
helio-starter-web/src/main/java/cc/uncarbon/framework/web/enums/ErrorResponseEnum.java

@@ -8,8 +8,10 @@ import lombok.Getter;
 @AllArgsConstructor
 @Getter
 public enum ErrorResponseEnum implements HelioBaseEnum<Integer> {
+
     ILLEGAL_ENUM_VALUE(400, "非法枚举值"),
     CONTAINS_ILLEGAL_CHARACTER(400, "包含非法字符"),
+
     ;
 
     private final Integer value;

+ 5 - 1
helio-starter-web/src/main/java/cc/uncarbon/framework/web/model/request/IdsDTO.java

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import lombok.experimental.SuperBuilder;
 
 import javax.validation.constraints.NotEmpty;
 import java.io.Serializable;
@@ -17,10 +19,12 @@ import java.util.List;
  *
  * @author Uncarbon
  */
+@Accessors(chain = true)
+@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
-public class IdsDTO<T> implements Serializable {
+public class IdsDTO<T extends Serializable> implements Serializable {
 
     @ApiModelProperty(value = "主键ID数组", required = true)
     @NotEmpty(message = "ids不能为空")

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

@@ -1,6 +1,7 @@
 package cc.uncarbon.framework.web.model.response;
 
 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;
@@ -19,7 +20,7 @@ import java.io.Serializable;
  */
 @ApiModel(value = "HTTP接口通用返回对象")
 @Accessors(chain = true)
-@SuperBuilder(toBuilder = true)
+@SuperBuilder
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
@@ -58,6 +59,14 @@ public class ApiResult<T> implements Serializable {
         return build(HttpStatus.HTTP_OK, msg, data);
     }
 
+    public static <T> ApiResult<T> build(HelioBaseEnum<Integer> enumItem) {
+        return build(enumItem.getValue(), enumItem.getLabel(), null);
+    }
+
+    public static <T> ApiResult<T> build(HelioBaseEnum<Integer> enumItem, T data) {
+        return build(enumItem.getValue(), enumItem.getLabel(), data);
+    }
+
     private static <T> ApiResult<T> build(Integer code, String msg, T data) {
         ApiResult<T> ret = new ApiResult<>();
         ret
@@ -67,5 +76,4 @@ public class ApiResult<T> implements Serializable {
 
         return ret;
     }
-
 }

+ 4 - 5
helio-starter-web/src/main/java/cc/uncarbon/framework/web/util/InvalidFieldUtil.java

@@ -2,17 +2,16 @@ package cc.uncarbon.framework.web.util;
 
 import cn.hutool.core.collection.CollUtil;
 import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
 import lombok.AllArgsConstructor;
-import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import lombok.experimental.SuperBuilder;
 import lombok.experimental.UtilityClass;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.FieldError;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * 参数绑定验证
  *
@@ -64,7 +63,7 @@ public class InvalidFieldUtil {
         return invalidFieldList;
     }
 
-    @Builder
+    @SuperBuilder
     @AllArgsConstructor
     @NoArgsConstructor
     @Data

+ 33 - 14
pom.xml

@@ -22,43 +22,43 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.4.13</version>
+        <version>2.5.9</version>
         <relativePath/>
     </parent>
 
     <groupId>cc.uncarbon.framework</groupId>
     <artifactId>helio-starters</artifactId>
-    <version>1.3.0</version>
+    <version>1.4.0</version>
 
     <properties>
         <!-- core versions -->
-        <helio-starters.version>1.3.0</helio-starters.version>
+        <helio-starters.version>1.4.0</helio-starters.version>
         <!-- JDK8则改为'1.8'  JDK11则改为'11' -->
-        <java.version>15</java.version>
+        <java.version>1.8</java.version>
         <!-- 若变更Spring Boot版本, 上面parent依赖版本也要变 -->
-        <spring-boot.version>2.4.13</spring-boot.version>
+        <spring-boot.version>2.5.9</spring-boot.version>
 
 
         <!-- Spring Cloud versions -->
+        <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-dependencies -->
+        <spring-cloud.version>2020.0.5</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.1</spring-cloud-alibaba.version>
-        <!-- DON'T upgrade Dubbo -->
+        <!-- DON'T UPGRADE TO 3.X -->
         <dubbo.version>2.7.12</dubbo.version>
         <seata.vesion>1.4.2</seata.vesion>
         <nacos-client.vesion>2.0.3</nacos-client.vesion>
 
 
         <!-- 3rd-party versions -->
-        <hutool.version>5.7.16</hutool.version>
-        <!-- 暂不升级,用 1.28.0 时存在 ThreadLocal 溢出问题,待观察 -->
-        <sa-token.version>1.27.0</sa-token.version>
+        <hutool.version>5.7.20</hutool.version>
+        <sa-token.version>1.28.0</sa-token.version>
         <transmittable-thread-local.version>2.12.1</transmittable-thread-local.version>
         <mybatis-plus.version>3.4.3.4</mybatis-plus.version>
         <knife4j.version>3.0.3</knife4j.version>
-        <redisson.version>3.16.3</redisson.version>
+        <redisson.version>3.16.7</redisson.version>
         <aspectj.version>1.9.6</aspectj.version>
         <ons-client.version>1.8.8.1.Final</ons-client.version>
 
@@ -303,6 +303,17 @@
                 <groupId>com.github.xiaoymin</groupId>
                 <artifactId>knife4j-spring-boot-starter</artifactId>
                 <version>${knife4j.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.apache.commons</groupId>
+                        <artifactId>commons-lang3</artifactId>
+                    </exclusion>
+
+                    <exclusion>
+                        <groupId>com.google.guava</groupId>
+                        <artifactId>guava</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
 
             <dependency>
@@ -368,8 +379,8 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-starter-web</artifactId>
                 <version>${spring-boot.version}</version>
-                <!-- 排除内置Tomcat,starter-web中会另外引入Undertow作为Web容器 -->
                 <exclusions>
+                    <!-- 排除内置 Tomcat ,starter-web 中会另外引入 Undertow 作为 Web 容器 -->
                     <exclusion>
                         <groupId>org.springframework.boot</groupId>
                         <artifactId>spring-boot-starter-tomcat</artifactId>
@@ -384,7 +395,7 @@
             </dependency>
 
 
-            <!-- 以下两个不知道为什么, 好像一定得加 -->
+            <!-- Spring Boot & Cloud dependencies -->
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-dependencies</artifactId>
@@ -393,6 +404,14 @@
                 <scope>import</scope>
             </dependency>
 
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>${spring-cloud.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
             <dependency>
                 <groupId>com.alibaba.cloud</groupId>
                 <artifactId>spring-cloud-alibaba-dependencies</artifactId>
@@ -402,4 +421,4 @@
             </dependency>
         </dependencies>
     </dependencyManagement>
-</project>
+</project>