Skip to content

RefreshScode refresh mechanism is not safe #1478

Open
@shiyiyue1102

Description

@shiyiyue1102

Is your feature request related to a problem? Please describe.

@RefreshScope may not be secure enough as it will first destroy the current bean and then create a new bean. What if the environment properties encounter an exception when creating a new bean? This online running application will be a disaster.

Describe the solution you'd like

Is it possible to adjust the order and first try creating a temporary bean? If it can be initialized normally, then replace the original bean. This will be a significant optimization for runtime configuration updates.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context

In addition,if it is possible to move @RefreshScope from spring-cloud to spring boot? it should not be bundled to spring cloud project.

I am a core builder in the Nacos community (https://nacos.io/en/) which is widely used by chinese developer community and I am responsible for config center.
We want to implement all configurations on the hosted application side, support elegant updates during runtime, and improve the efficiency of business software iteration. If Spring can support elegant refresh beans, then there is no need for every second party middleware to implement this feature

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions