Explorar o código

fix 修复 jackson createContextual 用法不标准导致可能出现的并发问题(https://gitee.com/dromara/RuoYi-Cloud-Plus/issues/IFAM5Z)

疯狂的狮子Li hai 4 meses
pai
achega
337c2f7170

+ 9 - 0
ruoyi-common/ruoyi-common-sensitive/src/main/java/org/dromara/common/sensitive/handler/SensitiveHandler.java

@@ -29,6 +29,15 @@ public class SensitiveHandler extends JsonSerializer<String> implements Contextu
     private final String[] roleKey;
     private final String[] perms;
 
+    /**
+     * 提供给 jackson 创建上下文序列化器时使用 不然会报错
+     */
+    public SensitiveHandler() {
+        this.strategy = null;
+        this.roleKey = null;
+        this.perms = null;
+    }
+
     public SensitiveHandler(SensitiveStrategy strategy, String[] strings, String[] perms) {
         this.strategy = strategy;
         this.roleKey = strings;

+ 7 - 0
ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/handler/TranslationHandler.java

@@ -33,6 +33,13 @@ public class TranslationHandler extends JsonSerializer<Object> implements Contex
 
     private final Translation translation;
 
+    /**
+     * 提供给 jackson 创建上下文序列化器时使用 不然会报错
+     */
+    public TranslationHandler() {
+        this.translation = null;
+    }
+
     public TranslationHandler(Translation translation) {
         this.translation = translation;
     }