Enabling the MicroProfile Config API
To configure the Liberty server to run an application that is enabled for the MicroProfile Config API, you must set the feature for the server.
For information about using the Liberty MicroProfile Config feature versions 1.1 and later, see the Open Liberty website
Using the MicroProfile Config API information, decide what configuration parameters are
required by your code. Consider how these configuration values can be stored and how they might vary
across services and over the lifetime of the service from:
- Assembly and installation
- Runtime service scaling and failover
Configure the feature. Update the server.xml file to add the
For example, configure the server.xml file to use the
mpConfig-1.3feature. To enable the
mpConfig-1.3feature, add the following feature definition to your server.xml file:
For more information about
<featureManager> <feature>mpConfig-1.3</feature> </featureManager>
mpConfig-1.3, see the MicroProfile Config 1.3 specification at https://github.com/eclipse/microprofile-config/releases/tag/1.3.Optional: Both
mpConfig-1.1are still supported as configuration options.
Create appropriate configuration value sources.
For example, property files can be packaged with an application and the value sources can be overridden later. This can happen during application composition by using property files in an EAR assembly, Liberty shared libraries, or server process environment variables.
- Use the API to access the configuration values.