I’m new to loading a custom .properties file and am doing so from within my Spring MVC app.
I have a properties file at: com.company.wtwebapp.properties.wtwebapp.properties
I have tried as below as well as a variety of combinations (leaving out the src.main.java, using “/” instead of “.”) but nothing works.
ResourceBundle rb = ResourceBundle.getBundle
("src.main.java.com.company.wtwebapp.properties.wtwebapp.properties");
On my classpath file I have:
<classpathentry kind="lib" path="src/main/java/com/company/wtwebapp/properties/wtwebapp.properties"/>
I always get the error:
java.util.MissingResourceException: Can't find bundle for base name src.main.java.com.company.wtwebapp.properties.wtwebapp.properties, locale en_US
I would appreciate any advice on the proper way / better way to accomplish the loading of the properties file. I have been doing a lot of searches but they are just leading to more confusion as from what I can tell what I am doing should be working (but obviously something is wrong). Thanks
From the javadoc:
You are supposed to provide the basename only; remove the
.propertiessuffix. Also if the bundle is in the same directory as the class, remove all the path information.