实现自动刷新 config server 是不需要修改的,去 config client 真正的微服务那边去修改
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.当配置发生修改的时候,用
@RefreshScope标注的springbean它会得到特殊处理。
For instance if a
DataSource
has open connections when the database URL is changed via theEnvironment
, 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.举