[ISSUE #361] support handling deleted config in @NacosValue#362
Open
zmz789 wants to merge 1 commit intonacos-group:developfrom
Open
[ISSUE #361] support handling deleted config in @NacosValue#362zmz789 wants to merge 1 commit intonacos-group:developfrom
zmz789 wants to merge 1 commit intonacos-group:developfrom
Conversation
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.
Please do not create a Pull Request without creating an issue first.
What is the purpose of the change
当前 @NacosValue 在 Nacos 配置被删除时,会保留历史值不变,导致应用无法感知配置已删除,继续使用过期的配置值,可能引发业务逻辑错误。本改动通过新增 nacosValue.resetOnConfigDelete 配置项,提供了一种可选的重置行为:当配置被删除时,优先使用用户在注解中定义的默认值(如 ${value:500} 中的500),若无用户默认值则回退到类型默认值。这样既保证了向后兼容(默认行为不变),又为需要感知配置删除的场景提供了明确的重置机制,避免应用在配置删除后继续使用过期值。
Brief changelog
Verifying this change
中配置),确认字段值重置为 500(用户自定义默认值)
Follow this checklist to help us incorporate your contribution quickly and easily:
[ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=trueto make sure basic checks pass. Runmvn clean install -DskipITsto make sure unit-test pass. Runmvn clean test-compile failsafe:integration-testto make sure integration-test pass.