官术网_书友最值得收藏!

Understanding Eclipse MicroProfile Config

Every application needs some external configuration to adapt its behavior to the runtime platform it's running on. It can range from the HTTP endpoints that the application must connect to, or the size of some internal structures.

These configuration parameters can also come from different sources:

  • From the operating system or the container in a cloud-native environment (through the use of environment variables)
  • From the Java virtual machine (with system properties)
  • From some external configuration files (such as the Java properties file)
  • From other places (an LDAP server, database, key-value store, and so on)

On the one hand, these configuration parameters come from many different sources. On the other hand, we want to consume them in the Java application in a simple way that does not depend on the source of the configuration. The Eclipse MicroProfile Config specification addresses this problem.

The MicroProfile Config API is split into two parts that tackle the two sides of the problem:

  • The API defines the Config and @ConfigProperty types that are used by the Java application to get the values of the configuration parameters.
  • The API also defines a Service Provider Interface (SPI) to let other projects (or the Java application itself) provide the sources of configuration parameters.

Implementations of MicroProfile Config must provide default ConfigSource implementations that are always available to the application.

For most use cases, the application will mainly be interested in reading configuration from the Config API, which we will cover in the next section.

主站蜘蛛池模板: 荥经县| 山阴县| 九台市| 宁陵县| 上饶县| 偏关县| 邮箱| 刚察县| 罗山县| 微博| 阜南县| 闻喜县| 达拉特旗| 天祝| 全州县| 朝阳市| 炉霍县| 鄂托克旗| 奉新县| 和平区| 原平市| 永泰县| 蒙自县| 东至县| 德阳市| 泸西县| 岳池县| 孟津县| 江山市| 贵州省| 元朗区| 濉溪县| 开封市| 东阿县| 洛扎县| 穆棱市| 金秀| 历史| 延川县| 连州市| 利川市|