PropertiesUtil.java 788 Bytes
package com.glsx.common.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * 
 * @Title PropertiesUtil.java
 * @Package com.glsx.manager.utils
 * @Description TODO 读取配置文件属性值
 * @author zhanghj
 * @date 2018年12月24日 下午5:38:42
 * @version 1.0.0
 */
@Component
public class PropertiesUtil {
	
	private static Environment env;

	@Autowired
	public void setEnv(Environment env) {
		PropertiesUtil.env = env;
	}
	
	public static String getProperty(String key){
		return env.getProperty(key);
	}

	public static String getProperty(String key, String defaultVal){
		return env.getProperty(key, defaultVal);
	}
}