spring 替换占位符,工具类

import org.springframework.util.PropertyPlaceholderHelper;

import java.util.Properties;

/**
 * @author liyhu
 * @date 2019年08月14日
 */
public class PlaceholderUtil {
    private static PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper(
            "#{", "}", ":", false);

    /**
     * 替换占位符
     * @param value
     * @param properties
     * @return
     */
    public static String replacePlaceholders(String value, final Properties properties) {
       return helper.replacePlaceholders(value, properties);
    }

    public static void main(String[] args) {

    }
}
相关文章
相关标签/搜索