Default ConfigSources
By default, a MicroProfile Config implementation must provide three sources of configuration:
- System properties from the Java virtual machine (with an ordinal of 400)
- Environment variables (with an ordinal of 300)
- Properties stored in META-INF/microprofile-config.properties (with an ordinal of 100)
The ordinal value of a config source determines the precedence of the config source. In particular, if a property is defined both in the system properties and the environment variables, the value will be taken from the system properties (which has a higher ordinal than the environment variables).
There are no restrictions on the names of properties. However, some operating systems can impose some restrictions on the name of the environment variables (for example, "." is not allowed by most Unix shells). If you have a property that could be configured from the environment variables, you have to name your property accordingly.
For example, the property name my_url can be used by an environment variable while my.url cannot.
New in MicroProfile Config 1.3
MicroProfile Config 1.3 introduces a mapping rule from the config property name to the environment variable. This rule searches three environment variable variants for each property name:
MicroProfile Config 1.3 introduces a mapping rule from the config property name to the environment variable. This rule searches three environment variable variants for each property name:
- Exact match
- Replace any non-alphanumeric character with _
- Replace any non-alphanumeric character with _ and use uppercase
Let's move on to the other type of configuration source.
推薦閱讀
- 物聯網標準化指南
- 物聯網與北斗應用
- 自動駕駛網絡:自智時代的網絡架構
- EDA技術與VHDL編程
- 物聯網網絡安全及應用
- 物聯網之魂:物聯網協議與物聯網操作系統
- Web Application Development with R Using Shiny
- Windows Server 2003 Active Directory Design and Implementation: Creating, Migrating, and Merging Networks
- 智慧城市中的移動互聯網技術
- Spring Cloud微服務架構進階
- 信息通信網絡建設安全管理概要2
- Spring 5.0 Projects
- Learning Windows 8 Game Development
- 云工廠:開啟中國制造云時代
- Selenium WebDriver 3 Practical Guide