Skip to content

SmallRye Config#

SmallRye Config is a library that provides a way to configure applications, frameworks and containers. It is used in applications servers like WildFly, Open Liberty and TomEE or frameworks like Quarkus. It can also be used completely standalone in any Java application, which makes it a very flexible library.

It follows the MicroProfile Config specification to provide the initial config foundations and expands with it own concepts to cover a wide range of use cases observed in the configuration space.

Use SmallRye Config in a Java application#

Add the dependency to your project using your preferred build tool:

<dependency>
    <groupId>io.smallrye.config</groupId>
    <artifactId>smallrye-config</artifactId>
    <version>3.10.1</version>
</dependency>
implementation 'io.smallrye.config:smallrye-config:3.10.1'
implementation("io.smallrye.config:smallrye-config:3.10.1")
//DEPS io.smallrye.config:smallrye-config:3.10.1

And retrieve a SmallRyeConfig instance with:

SmallRyeConfig config = ConfigProvider.getConfig().unwrap(SmallRyeConfig.class);

Info

The SmallRyeConfig instance will be created and registered to the context class loader if no such configuration is already created and registered.

Or build your own:

SmallRyeConfig config = new SmallRyeConfigBuilder().build();

Info

SmallRyeConfig is the entry point to all the config capabilities provided by SmallRye Config.