You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal with example above is simple - to extract only necessary properties into applicaiton.conf and reuse reference.conf in different applications without duplicating properties in it. It looks like pom files in maven - parent pom contains everything, but child only defines necessary properties.
When ConfigFactory.load() is invoked it loads reference.conf, then loads application.conf, merges they together and override properties reference from application. With that algorithm load function fails, because reference.conf do not contain app.port property which is defined in application.conf. Is it expected behavior? May be a correct algorithm will be to merge plain text files application.conf and reference.conf and then resolve properties in it?
Also can resolve these properties just add include "application". But first in that case module with reference depends on unexisted file and second - what if there are several files, which named differently that application, but need to reuse reference.conf too?
So in total: resolve a bug or add feature to merge conf files at the end (it can be as default behavior or as pass a argument to ConfigFactory.load())
The text was updated successfully, but these errors were encountered:
#167 has discussion of this and some suggestions. One option is to have multiple application.conf or reference.conf. Or have something.conf which all your application.conf pull in.
This policy decision in ConfigFactory.load is only the thinnest of surface convenience layers, so worst case you can copy a short method out of ConfigFactory.java and tweak it as desired.
Changing how it works by default isn't really feasible due to back compat.
I have two files - reference.conf and application.conf
application.conf
reference.conf
The goal with example above is simple - to extract only necessary properties into applicaiton.conf and reuse reference.conf in different applications without duplicating properties in it. It looks like pom files in maven - parent pom contains everything, but child only defines necessary properties.
When
ConfigFactory.load()
is invoked it loads reference.conf, then loads application.conf, merges they together and override properties reference from application. With that algorithmload
function fails, because reference.conf do not containapp.port
property which is defined in application.conf. Is it expected behavior? May be a correct algorithm will be to merge plain text files application.conf and reference.conf and then resolve properties in it?Also can resolve these properties just add
include "application"
. But first in that case module with reference depends on unexisted file and second - what if there are several files, which named differently that application, but need to reuse reference.conf too?So in total: resolve a bug or add feature to merge conf files at the end (it can be as default behavior or as pass a argument to
ConfigFactory.load()
)The text was updated successfully, but these errors were encountered: