-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto Updating Spring Placeholder Values #972
Merged
lepdou
merged 2 commits into
apolloconfig:master
from
nobodyiam:auto-update-value-merge
Feb 24, 2018
Merged
Auto Updating Spring Placeholder Values #972
lepdou
merged 2 commits into
apolloconfig:master
from
nobodyiam:auto-update-value-merge
Feb 24, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2. Support XML config placeholders 3. Add more tests to cover all kinds of cases 4. Update apollo demo to adapt for auto update functionality
Codecov Report
@@ Coverage Diff @@
## master #972 +/- ##
============================================
+ Coverage 46.91% 48.28% +1.36%
- Complexity 1554 1650 +96
============================================
Files 354 360 +6
Lines 9755 10062 +307
Branches 968 1012 +44
============================================
+ Hits 4577 4858 +281
- Misses 4835 4847 +12
- Partials 343 357 +14
Continue to review full report at Codecov.
|
This was referenced Feb 24, 2018
Great job! |
Perfect! |
Closed
Closed
nice |
Closed
嗯!! |
您好,您的邮件我已收到
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Auto Updating Spring Placeholder Values
1. Features
Spring placeholder values will now be auto updated when new configs are released in Apollo.
1.1
@Value
PlaceholdersFull support is provided for:
@Value
placeholders annotated on fields@Value
placeholders annotated on methods@Value
placeholders with Spring Expression LanguageFor example, the following 3 fields can all be auto updated when the corresponding config is changed:
Sample Configurations:
We also provide limited support for nested placeholders.
For example, with the following configurations and program:
batch
equals tonormalBatch
at first, so the initial nestedProperty equals to1000
batch
is changed tospecialBatch
, then the nestedProperty field will be changed to5000
batch
config and changenormalBatch
to5000
instead, then the nestedProperty won't be auto updated1.2 XML Placeholders
Full support is provided for placeholders for property field.
For example, the following 3 fields can all be auto updated when the corresponding config is changed:
Xml Config:
Sample Configurations:
We also provide limited support for nested placeholders, the same as
@Value
placeholders.2. Configuration
This auto update feature is turned on by default, you could turn off this feature by:
Specify
apollo.autoUpdateInjectedSpringProperties=false
in System PropertiesFor example, you may pass
-Dapollo.autoUpdateInjectedSpringProperties=false
when starting the Java programSpecify
apollo.autoUpdateInjectedSpringProperties=false
in META-INF/app.propertiesFor example,