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.
推薦閱讀
- 物聯(lián)網(wǎng)標(biāo)準(zhǔn)化指南
- 計(jì)算機(jī)網(wǎng)絡(luò)與通信(第2版)
- JBoss EAP6 High Availability
- 互聯(lián)網(wǎng)安全的40個(gè)智慧洞見:2014年中國互聯(lián)網(wǎng)安全大會(huì)文集
- 正在爆發(fā)的互聯(lián)網(wǎng)革命
- 世界互聯(lián)網(wǎng)發(fā)展報(bào)告·2019
- 雷達(dá)饋線技術(shù)
- 面向5G-Advanced的關(guān)鍵技術(shù)
- Learning Windows 8 Game Development
- Scala Design Patterns.
- 6G無線網(wǎng)絡(luò)空口關(guān)鍵技術(shù)
- RestKit for iOS
- 從物聯(lián)到萬聯(lián):Node.js與樹莓派萬維物聯(lián)網(wǎng)構(gòu)建實(shí)戰(zhàn)
- 黑客與反黑工具使用詳解
- Building Microservices with Spring