I'm trying to read some props from backupData.properties
. It locates in WEB-INF/classes/
. This is how I do:
public class Configures {
private static final String INPUT_FILE = "WEB-INF//classes//backupData.properties";
public static String getMail() {
Properties prop = new Properties();
try {
//load a properties file
prop.load(new FileInputStream(INPUT_FILE));
//get the property value
return prop.getProperty("mail");
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
}
}
What INPUT_FILE
should contain? I was trying to put it in src
, like src//backupData.properties
, but it throws FileNotFoundException
. I googled that file should locate in CLASSPATH
(in WEB-INF/classes
as I understood). What is wrong?
PS. I'm using Spring.