java刷新文件_java-如何在运行时更改属性文件并刷新配置...

A Spring @Bean that is marked as @RefreshScope will get special

treatment when there is a configuration change. This addresses the

problem of stateful beans that only get their configuration injected

when they are initialized. For instance if a DataSource has open

connections when the database URL is changed via the Environment, we

probably want the holders of those connections to be able to complete

what they are doing. Then the next time someone borrows a connection

from the pool he gets one with the new URL.

The RefreshScope is a bean in the context and it has a public method

refreshAll() to refresh all beans in the scope by clearing the target

cache. There is also a refresh(String) method to refresh an individual

bean by name. This functionality is exposed in the /refresh endpoint

(over HTTP or JMX).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值