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) {

    }
}
相關文章
相關標籤/搜索