I use typesafe config and try to override some properties in application.conf
from jar.
I have application.conf
inside my jar:
title: "test-inside"
sub-title: "sub-test-inside"
and application-test.conf
outside my jar:
include "application"
title: "test-outside"
I try to use both parameters inside my program.
I launch my jar with the next command:
java -Dconfig.file=application-test.conf -jar scala-spark-maven-1.0-SNAPSHOT-jar-with-dependencies.jar
But I get the error:
Exception in thread "main" com.typesafe.config.ConfigException$Missing: merge of system properties,application-test.conf: 1: No configuration setting found for key 'sub-title'
typesafe config doesn't use properties from inside application.conf
file.
CodePudding user response:
The problem was that I have to set ".\" before external application.conf file name.
java -Dconfig.file=.\application-test.conf -jar scala-spark-maven-1.0-SNAPSHOT-jar-with-dependencies.jar