From 52ebc0e4170ded35637dc59ec1984543a65f4cef Mon Sep 17 00:00:00 2001 From: huangjinmu Date: Tue, 13 Sep 2022 17:09:26 +0800 Subject: [PATCH] =?UTF-8?q?Context=E7=BA=BF=E7=A8=8B=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ink/rayin/htmladapter/base/thymeleaf/ThymeleafHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rayin-htmladapter-base/src/main/java/ink/rayin/htmladapter/base/thymeleaf/ThymeleafHandler.java b/rayin-htmladapter-base/src/main/java/ink/rayin/htmladapter/base/thymeleaf/ThymeleafHandler.java index 6206dbf..5718a76 100644 --- a/rayin-htmladapter-base/src/main/java/ink/rayin/htmladapter/base/thymeleaf/ThymeleafHandler.java +++ b/rayin-htmladapter-base/src/main/java/ink/rayin/htmladapter/base/thymeleaf/ThymeleafHandler.java @@ -39,7 +39,6 @@ import java.util.Map; public class ThymeleafHandler { private static TemplateEngine templateEngine = new TemplateEngine(); - private static Context context = new Context(); private static Logger logger = LoggerFactory.getLogger(ThymeleafHandler.class); private static ThymeleafHandler thymeleafHandler = new ThymeleafHandler(); Gson gson = new Gson(); @@ -60,6 +59,7 @@ public class ThymeleafHandler { * @return html字符串 */ public String templateEngineProcessByString(String htmlStr, JSONObject jsonData){ + Context context = new Context(); if(jsonData != null){ context.setVariables(gson.fromJson(jsonData.toJSONString(), Map.class)); } @@ -87,6 +87,7 @@ public class ThymeleafHandler { * @return 解析后的字符串 */ public String templateEngineProcessByPath(String filePath, JSONObject jsonData) { + Context context = new Context(); if(jsonData != null){ context.setVariables(JSON.parseObject(jsonData.toJSONString(),Map.class)); } -- Gitee