草庐IT

java - HOCON替换默认值

在HOCON和TypesafeConfig中,如何在替换的情况下设置默认值。它支持这样的东西吗??${server.host:'localhost'}->如果设置了server.host(在相同的配置文件中或通过环境设置),它会替代,如果未设置,则选择默认值 最佳答案 来自substitutions上的官方文档:Ifasubstitutionwiththe${?foo}syntaxisundefined:ifitisthevalueofanobjectfieldthenthefieldshouldnotbecreated.Ifthe