How to use external configuration file as a resource bundle?

151 Views Asked by At

I am trying to access external configuration files in which my command line are as follows:

java -jar myApp.jar --spring.config.name=myConfig --spring.config.location="file:///C:\\Desktop\\myConfigs\\"

Within my code, this myConfig.properties is accessed using ResourceBundle.getBundle('myConfig') and .getString("tbl.person"). And having removed the file before I generated the .jar file, whenever I executed the above code, I am getting following error:

java.util.MissingResourceException: Can't find bundle for base name myConfig, locale en_SG
    at java.util.ResourceBundle.throwMissingResourceExcepton(Unknown Source)

Snippet of myConfig.properties file:

tbl.person=Person
tbl.address=Address

I have tried System.getProperty() but to no avail results.

Appreciate in advance for any replies.

P.S: One of the reason I am calling this config file externally is because in the event if I needed to add in more info, there is no need for me to re-generate the .jar file all over again

0

There are 0 best solutions below