fix
Helius
2022-07-08 6601d3ecbdcb94a014eaebe275bf824e2c25ef1a
src/main/java/com/xcong/farmer/cms/core/node/AttrNode.java
@@ -8,6 +8,7 @@
import com.xcong.farmer.cms.core.tag.TagsEnum;
import com.xcong.farmer.cms.core.template.Configuration;
import com.xcong.farmer.cms.core.template.TemplateConfiguration;
import com.xcong.farmer.cms.utils.GroovySingleton;
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
import org.apache.commons.text.StringSubstitutor;
@@ -213,7 +214,8 @@
//                }
//            }
            Binding binding = new Binding();
            GroovyShell groovyShell = GroovySingleton.getSingleton();
            Binding binding = groovyShell.getContext();
            for (Map.Entry<String, Object> entry : this.parserData.entrySet()) {
                String fieldKey = entry.getKey();
                Map<String, Object> data = (Map<String, Object>) entry.getValue();
@@ -224,13 +226,14 @@
                binding.setProperty("system", systemData);
            }
            GroovyShell shell = new GroovyShell(binding);
            Object evaluate = shell.evaluate(group);
//            GroovyShell shell = new GroovyShell(binding);
            Object evaluate = groovyShell.evaluate(group);
            if (evaluate == null) {
                targetData.put(group, "");
            } else {
                targetData.put(group, evaluate.toString());
            }
            groovyShell.getClassLoader().clearCache();
        }
        StringSubstitutor str = new StringSubstitutor(targetData);