spring-cloud / spring-cloud/spring-cloud-commons
Question: Can ConfigurationPropertiesRebinder Refresh Be Aligned with @RefreshScope Behavior?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
Is your feature request related to a problem? Please describe.
The ConfigurationPropertiesRebinder refresh mechanism works by performing destroy and initial processes on existing bean objects. During refresh, some property values may not be properly handled (for example, if certain configuration items are deleted, the corresponding property values are not cleared). To clear these property values, I need to add the @RefreshScope annotation and leverage its mechanism to refresh the inner bean. However, I am cautious about using the @RefreshScope annotation because its lazy loading and re-creation behavior may lead to bean retrieval failures or slowdowns (such as exceptions thrown in constructors or lifecycle methods).
Describe the solution you'd like
Is it possible to initialize a new bean during the ConfigurationPropertiesRebinder binding process and assign its values to the original bean? This would align the refresh behaviors of @RefreshScope and ConfigurationProperties.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading ConfigurationPropertiesRebinder and the @RefreshScope behavior described in the issue, focusing on how deleted configuration values and bean recreation are handled. Trace the existing refresh and binding entry points, then define and validate the intended behavior for replacing or updating the original bean, including constructor and lifecycle failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100