Skip to content

HOCON Config Source#

This Config Source allows to use the HOCON file format to load configuration values. The HOCON Config Source loads the configuration from the file META-INF/microprofile-config.conf. It has a lower ordinal (50) than the microprofile-config.properties.

The following dependency is required in the classpath to use the HOCON Config Source:

<dependency>
    <groupId>io.smallrye.config</groupId>
    <artifactId>smallrye-config-source-hocon</artifactId>
    <version>3.10.2-SNAPSHOT</version>
</dependency>

Expressions defined as ${value} (unquoted) are resolved internally by the HOCON Config Source as described in the HOCON Substitutions documentation. Quoted Expressions defined as "${value}" are resolved by SmallRye Config Property Expressions.

Consider:

hocon.conf

{
   foo: "bar",
   hocon: ${foo},
   config: "${foo}" 
}

application.properties

config_ordinal=1000
foo=baz

The value of hocon is bar and the value of config is baz (if the properties source has a higher ordinal).