Tamaya Microprofile Implementation (Extension Module)

Tamaya Microprofile is an extension module. Refer to the extensions documentation for further details.

What functionality this module provides ?

Tamaya Microprofile currently provides full integration for the Microprofile Configuration API:

  • A Microprofile ConfigSource implementation can be used with Tamaya.

  • A Tamaya PropertySource can be used with any Microprofile implementation.

  • The same is also true for Converter,PropertyConverter.

  • Nevertheless Tamaya also fully implements the Microprofile API and also successfully is compatible with the Microprofile TCK.


Both modules are based on Java 8. The implemented Microprofile API is currently version 1.1.


To benefit from Tamaya Microprofile you only must one of the following dependencies to your module:


Using Microprofile API

Refer to http://microprofile.io/project/eclipse/microprofile-config for details on how the API works and should be used. In general, you will see many similarities with Tamaya, since Tamaya heavily influenced the design of microprofile.io regarding configuration. Nevertheless Tamaya’s API is much more complete and provides far more feature as of now. Further changes in this area may be good to be expected, since as of now also a corresponding specification (JSR) has been started and will be supported by Tamaya as well.


Config config = Configuration.current();
String serverUrl = config.getValue("acme.myprj.some.url", String.class);

// =====================================================================

// CDI Injection API

public class InjectedConfigUsageSample {

    private Config config;

    //The property myprj.some.url must exist in one of the configsources, otherwise a
    //DeploymentException will be thrown.
    private String someUrl;
    //The following code injects an Optional value of myprj.some.port property.
    //Contrary to natively injecting the configured value this will not lead to a
    //DeploymentException if the configured value is missing.
    private Optional<Integer> somePort;
    //Injects a Provider for the value of myprj.some.dynamic.timeout property to
    //resolve the property dynamically. Each invocation to Provider#get() will
    //resolve the latest value from underlying Config.
    //The existence of configured values will get checked during startup.
    //Instances of Provider<T> are guaranteed to be Serializable.
    @ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100")
    private javax.inject.Provider<Long> timeout;