Reputation: 15385
I'm trying to load the application.conf that I have under my resources folder using the following line:
val config = ConfigFactory.load(getClass.getResource("application.conf").getPath)
However, it fails and the application.conf is not loaded. There is no error or whatsoever. Any ideas as to what to look for?
Upvotes: 2
Views: 4138
Reputation: 1960
You can make the library produce a nice meaningful error, using this overload of ConfigFactory.load.
val config = ConfigFactory.load(configName,
ConfigParseOptions.defaults().setAllowMissing(false),
ConfigResolveOptions.defaults())
(I was fairly surprised that they didn't make this the default).
Upvotes: 3
Reputation: 849
ConfigFactory.load takes a resource-name as parameter not a complete path. So it should be enough if you just use "application.conf"
as argument, like this:
ConfigFactory.load("application.conf")
As "application.conf
is the default name anyways it should actually be enough to just go without arguments:
ConfigFactory.load()
Upvotes: 5