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.

Open Liberty For information about using the Liberty MicroProfile Config feature versions 1.1 and later, see the Open Liberty website

Procedure

  1. 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:
    • Development
    • Test
    • Assembly and installation
    • Runtime service scaling and failover
  2. Configure the feature. Update the server.xml file to add the feature.
    For example, configure the server.xml file to use the mpConfig-1.3 feature. To enable the mpConfig-1.3 feature, add the following feature definition to your server.xml file:
    <featureManager>
        <feature>mpConfig-1.3</feature>
    </featureManager>
    For more information about 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.2 and mpConfig-1.1 are still supported as configuration options.
  3. 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.
  4. Use the API to access the configuration values.