I want to load Properties Files in Java code. But I use profile to config -Dspring.profiles.active=local or dev... How to load properties files by profile Something like this:
classpath:${spring.profiles.active}/test.properties
How to do that in Java code ? I did as below, but get null.
Properties prop = new Properties();
InputStream iStream = Helper.class.getClassLoader().getResourceAsStream("test.properties");
try {
prop.load(iStream);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
} finally {
try {
iStream.close();
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
}