|
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
|
|
|
|
/**
|
|
|
|
|
* @author 3y
|
|
|
|
|
* 内容占位符 替换
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* austin占位符格式{$var}
|
|
|
|
|
*/
|
|
|
|
|
public class ContentHolderUtil {
|
|
|
|
@ -23,16 +23,16 @@ public class ContentHolderUtil {
|
|
|
|
|
/**
|
|
|
|
|
* 占位符后缀
|
|
|
|
|
*/
|
|
|
|
|
private static final String PLACE_HOLDER_ENDFIX = "}";
|
|
|
|
|
private static final String PLACE_HOLDER_SUFFIX = "}";
|
|
|
|
|
|
|
|
|
|
private static final StandardEvaluationContext EVALUTION_CONTEXT;
|
|
|
|
|
private static final StandardEvaluationContext EVALUATION_CONTEXT;
|
|
|
|
|
|
|
|
|
|
private static PropertyPlaceholderHelper propertyPlaceholderHelper = new PropertyPlaceholderHelper(
|
|
|
|
|
PLACE_HOLDER_PREFIX, PLACE_HOLDER_ENDFIX);
|
|
|
|
|
private static final PropertyPlaceholderHelper propertyPlaceholderHelper = new PropertyPlaceholderHelper(
|
|
|
|
|
PLACE_HOLDER_PREFIX, PLACE_HOLDER_SUFFIX);
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
EVALUTION_CONTEXT = new StandardEvaluationContext();
|
|
|
|
|
EVALUTION_CONTEXT.addPropertyAccessor(new MapAccessor());
|
|
|
|
|
EVALUATION_CONTEXT = new StandardEvaluationContext();
|
|
|
|
|
EVALUATION_CONTEXT.addPropertyAccessor(new MapAccessor());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String replacePlaceHolder(final String template, final Map<String, String> paramMap) {
|
|
|
|
@ -42,7 +42,7 @@ public class ContentHolderUtil {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static class CustomPlaceholderResolver implements PropertyPlaceholderHelper.PlaceholderResolver {
|
|
|
|
|
private Map<String, String> paramMap;
|
|
|
|
|
private final Map<String, String> paramMap;
|
|
|
|
|
|
|
|
|
|
public CustomPlaceholderResolver(Map<String, String> paramMap) {
|
|
|
|
|
super();
|
|
|
|
|