I create a springmvc web application. I want to read property file. I have a properties file app.properties located in resources
p.id=1
p.name=test
I have a class Constant.java
public class Constant{
public static PropertyFile{
public static final String APP="resources/app";
}
public static PropertyKey{
public static final String P_ID = "p.id";
public static final String P_Name = "p.name";
}
}
I have an AppSetting.java
public class AppSetting{
private static final ResourceBundle resource =
ResourceBundle.getBundle(Constants.PropertyFile.APP);
public String getId(){
return resource.getString(Constant.PropertyKey.P_ID);
}
}
when I called it AppSetting.getId(); it cannot find resource. Can you help me?