Skip to content

Stork MicroProfile Config#

Stork integrates with MicroProfile Configuration out of the box, enabling seamless access to configuration properties. This documentation explains how Stork can retrieve configuration details from the MicroProfile Config file present in the classpath. Quarkus uses this approach for reading configuration details from the MicroProfile Config file located within the classpath.

Dependency setup#

To enable MicroProfile Config integration in Stork, you need to include the following dependency:

<dependency>
    <groupId>io.smallrye.stork</groupId>
    <artifactId>smallrye-stork-microprofile</artifactId>
    <version>2.6.0</version>
</dependency>

Initializing Stork#

If your framework lacks a pre-configured Stork instance, you’ll need to perform initialization:

package examples;

import io.smallrye.stork.Stork;
import io.smallrye.stork.api.ServiceDefinition;
import io.smallrye.stork.api.ServiceInstance;
import io.smallrye.stork.loadbalancer.random.RandomConfiguration;
import io.smallrye.stork.servicediscovery.staticlist.StaticConfiguration;

import java.time.Duration;

public class InitializationExample {

    public static void main(String[] args) {
        Stork.initialize();
        Stork stork = Stork.getInstance();
        // ...
    }
}
Upon initialization, Stork scans for the io.smallrye.stork.config.MicroProfileConfigProvider SPI provider and CDI beans (from version 2.x onwards). It then builds a comprehensive list of managed services by parsing the properties configuration files.