Spring Event
2023-08-18 12:59:45 2 举报
spring
作者其他创作
大纲/内容
EventObject(JDK的类)
# source:Object( transient )
+ EventObject(Object source)+ getSource():Object
ApplicationEvent
+ ApplicationEvent(Object source)
ContextRefreshedEvent
+ ContextRefreshedEvent(Object source)
ApplicationEventMulticaster
+ addApplicationListener(ApplicationListener<?> listener)+ removeApplicationListener(ApplicationListener<?> listener)+ multicastEvent(ApplicationEvent event)
ApplicationEventPublisher
+ publishEvent(ApplicationEvent event)
事件定义者,规范事件接口,定义事件类型,默认定义了 ContextClosedEvent(上下文关闭事件,用于程序结束时的回调通知),ContextRefreshedEvent(上下文刷新事件,用于Spring对所有Bean生成完毕后进行事件通知)
ApplicationContextEvent
+ ApplicationContextEvent(Object source)+ getApplicationContext():ApplicationContext
ApplicationListener
+ onApplicationEvent(E event)
AbstractApplicationContext
+ APPLICATION_EVENT_MULTICASTER_BEAN_NAME:String- applicationEventMulticaster:ApplicationEventMulticaster
- initApplicationEventMulticaster()- finishRefresh()+ publishEvent(ApplicationEvent event)+ close()
ContextClosedEvent
+ ContextClosedEvent(Object source)
依赖
EventListener(JDK的类)
AbstractApplicationEventMulticaster
+ applicationListeners:Set<ApplicationListener<ApplicationEvent>>
事件监听者,所有监听器要实现ApplicationListener接口
0 条评论
下一页