scala - TypeSafe config : reference.conf values not overridden by application.conf -
i using typesafe application conf provide external connfig in scala project, while trying create shaded jar using maven-shade-plugin
, running somehow package conf in jar cannot overridden while changing values in application conf.
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-shade-plugin</artifactid> <version>${maven.shade.plugin.version}</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <createdependencyreducedpom>false</createdependencyreducedpom> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.manifestresourcetransformer"> <mainclass>test.myproj.dqjobtrigger</mainclass> </transformer> </transformers> </configuration> </execution> </executions> </plugin>
i not sure of behaviour when trying load configs application conf itself. using configfactory
trait config { private val dqconfig = system.getenv("conf_path") private val config = configfactory.parsefile(new file(dqconfig)) private val sparkconfig = config.getconfig("sparkconf") private val sparkconfig = config.getconfig("mysql") }
while conf_path set path application.conf exist while running jar.
application.conf
sparkconf = { master = "yarn-client" } mysql = { url = "jdbc:mysql://127.0.0.1:3306/test" user = "root" password = "mycustom98" driver = "com.mysql.jdbc.driver" connectionpool = disabled keepaliveconnection = true }
so if change properties in application conf still takes configs present while packaging jar.
Comments
Post a Comment