The org.eclipse.microprofile.config.Config interface is the entry point to retrieve configuration in a Java application.
There are two ways to get an instance of Config:
The first (and preferred) way is to use CDI to inject it into the code:
@Inject private Config config;
- The second way is to call the static method, org.eclipse.microprofile.config.ConfigProvider#getConfig(), to obtain an instance of Config:
Config config = ConfigProvider.getConfig();
The Config interface provides two methods to retrieve properties:
getValue(String propertyName, Class propertyType): This method throws a runtime exception if the property is not present in the configuration. This method must be used only for mandatory configuration ...