If i'm using Java, I can set custom application.properties location with something like this:
@PropertySources({
@PropertySource(value = "file:${APP_CONF_DIR}/application.properties", ignoreResourceNotFound = true)
})
Is there any way to do the same thing in Scala without using "-Dbla.bla=app.config" on application start
The behavior of Lightbend Config around loading
application.confis mostly fromConfigFactory.load(), which will look forapplication.confor the file/resource given by Java properties (the-Dconfig.fileand friends in your question).If not interested in setting the alternative to
application.confthrough Java properties, one can load a different resource from the classpath withConfigFactory.load("foo")to loadfoo.conf. Alternatively if one is loading a file, one can useConfigFactory.load(ConfigFactory.parseFile(file)), wherefileis ajava.io.File.