Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors the state management in the Azure App Configuration Spring library, moving from a static singleton pattern to an instance-based approach managed by Spring's dependency injection framework.
Changes:
- Refactored
StateHolderfrom a static singleton to an instance-based class registered in Spring's BootstrapContext and promoted to the ApplicationContext - Updated
AppConfigurationRefreshUtilto acceptStateHolderas a constructor parameter instead of using static methods - Modified tests to use instance-based StateHolder instead of static methods, splitting monolithic tests into focused unit tests
- Applied minor code quality improvements including replacing
.size() > 0with.isEmpty()and improving variable naming
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| StateHolder.java | Converted from package-private singleton to public instance-based class; removed static methods and singleton pattern |
| StateHolderTest.java | Refactored from single monolithic test to multiple focused tests using instance-based StateHolder |
| AppConfigurationRefreshUtil.java | Added StateHolder constructor parameter; converted static refresh methods to instance methods |
| AppConfigurationRefreshUtilTest.java | Updated to use mocked StateHolder instances instead of static method mocking |
| AppConfigurationPullRefresh.java | Added StateHolder constructor parameter and injected dependency |
| AppConfigurationPullRefreshTest.java | Updated constructor calls to include StateHolder mock; reorganized imports |
| AzureAppConfigBoostrapRegistrar.java | Added StateHolder registration in BootstrapContext with promotion to ApplicationContext |
| AzureAppConfigDataLoader.java | Modified to retrieve StateHolder from BootstrapContext instead of creating new instance |
| AppConfigurationWatchAutoConfiguration.java | Updated bean creation to retrieve StateHolder from BootstrapContext and pass to dependencies |
| ConnectionManager.java | Simplified client tracking by replacing currentReplica with lastActiveClient |
| ConfigStore.java | Improved variable naming (endpoint → validationEndpoint) and validation logic |
| AppConfigurationProperties.java | Replaced .size() > 0 with .isEmpty() for better code style |
| AppConfigurationReplicaClient.java | Replaced .size() > 0 with .isEmpty() for better code style |
| AppConfigurationApplicationSettingPropertySource.java | Added @OverRide annotation and removed unnecessary return statement from void method |
...ure/spring/cloud/appconfiguration/config/implementation/AppConfigurationPullRefreshTest.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/StateHolder.java
Show resolved
Hide resolved
...src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/StateHolder.java
Show resolved
Hide resolved
...m/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationRefreshUtil.java
Show resolved
Hide resolved
...m/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationPullRefresh.java
Show resolved
Hide resolved
This file contains hidden or 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
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.
Description
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines