8.1.1 Distributed Configuration

As you can see, Micronaut features a robust system for externalizing and adapting configuration to the environment inspired by similar approaches in Grails and Spring Boot.

However, what if you want multiple microservices to share configuration? Micronaut includes APIs for distributed configuration.

The ConfigurationClient interface has a getPropertySources method that can be implemented to read and resolve configuration from distributed sources.

The getPropertySources returns a Publisher that emits zero or many PropertySource instances.

The default implementation is DefaultCompositeConfigurationClient which merges all registered ConfigurationClient beans into a single bean.

You can either implement your own ConfigurationClient or use the implementations provided by Micronaut. The following sections cover those.