Should Config.getValue() to support variable replacement
See original GitHub issueTo address the issue #118, we have this PR #392 introducing a way on variable replacement.
In the class ConfigAccessorBuilder.evaluateVariable(boolean evaluateVariables), we would like to suggest the evaluateVariable is on by default.
However, the above only impacts the variable values obtained via ConfigAccess. In ConfigProperty annotation, we also introduced a property evaluateVariables with the default value of true.
Base on this, it might make sense to support evaluateVaribles by default with Config.getValue(). Basically, if a config contains a variable replacement, the variable will be evaluated.
server.host=localhost
server.port=9080
server.url=http://${server.host}:${server.port}
If this issue is accepted, a backward incompatible change will be introduced. This will lead MP Config release to bump major version.
when calling config.getValue(server.url, String.class) will return
http://localhost:9080
If this issue is accepted, a backward incompatible change will be introduced. Hence, this issue will lead MP Config release to bump major version.
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (16 by maintainers)
Top GitHub Comments
There is a final interceptor in the chain that performs the regular lookup. So, if the property doesn’t exist, you get the exception.
The same thing. The final chain will retrieve the raw value, but when going up the chain, that value can be modified by any interceptor. Something like: