在spring初始化的流程中,会发送一个容器刷新事件,这个事件,也是一个扩展点之一
先来看下发送刷新事件的源码
org.springframework.context.support.AbstractApplicationContext#refresh
org.springframework.context.support.AbstractApplicationContext#finishRefresh
从这个方法的注释中,就可以知道这个方法是干什么的
/**
* Finish the refresh of this context, invoking the LifecycleProcessor's
* onRefresh() method and publishing the
* {@link org.springframework.context.event.ContextRefreshedEvent}.
*/
protected void finishRefresh()

本文介绍了Spring在初始化过程中发送的容器刷新事件作为一个扩展点,可以通过监听该事件在容器刷新完成后执行自定义业务逻辑。Dubbo服务提供者利用此扩展点,在容器刷新后进行服务暴露,通过监听ContextRefreshEvent事件来启动服务暴露的过程。
最低0.47元/天 解锁文章
168万+

被折叠的 条评论
为什么被折叠?



