Skip to content
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

Question: Can ConfigurationPropertiesRebinder Refresh Be Aligned with @RefreshScope Behavior? #1374

Open
qnnn opened this issue Sep 3, 2024 · 1 comment

Comments

@qnnn
Copy link
Contributor

qnnn commented Sep 3, 2024

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.

@qnnn
Copy link
Contributor Author

qnnn commented Sep 3, 2024

This seems somewhat similar to the issue mentioned in #1372. Is there already a plan to address this? (Feel free to close this issue and continue the discussion in #1372.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants