package com.appUtils;
import java.util.Properties;
import org.springframework.core.io.support.PropertiesLoaderUtils;
/**
* 属性文件
* @author Administrator
*
*/
public class PropertyTools {
/**
* 获取属性值 通过Key得到属性值
*/
public static String getValue (String key){
Properties prop = new Properties();
try {
prop = PropertiesLoaderUtils.loadAllProperties("prop.properties");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return prop.getProperty(key);
}
public static void main(String[] args) {
String jobid=PropertyTools.getValue("quartz_statrt_jobid");
System.out.println(jobid);
}
}
加载resource目录下的配置文件 实时加载配置文件,不必重启
还没有评论,来说两句吧...