使用spring的PropertiesLoaderUtils得到properties
public class PropertiesUtils {
public static String getProperty(String name) {
String result = null;
java.util.Properties props;
try {
props = PropertiesLoaderUtils.loadAllProperties("login.properties");
result = props.getProperty(name);//根据name得到对应的value
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
}