public class DeferredApplicationEventPublisher extends Object implements org.springframework.context.ApplicationEventPublisher, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
ApplicationEventPublisher to resolve publishEvent(ApplicationEvent) too early to publish
ApplicationEvent when Spring
ApplicationContexts' ApplicationEventMulticaster is not ready, thus current class will hold all early
events temporary until Spring
ApplicationContext is active, and then those events will be replayed.| 限定符和类型 | 字段和说明 |
|---|---|
private org.springframework.context.ConfigurableApplicationContext |
context |
private ConcurrentLinkedQueue<org.springframework.context.ApplicationEvent> |
deferredEvents |
| 构造器和说明 |
|---|
DeferredApplicationEventPublisher(org.springframework.context.ConfigurableApplicationContext context) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) |
void |
publishEvent(org.springframework.context.ApplicationEvent event) |
void |
publishEvent(Object event) |
protected void |
publishEvent(Object event,
org.springframework.core.ResolvableType eventType) |
private void |
replayDeferredEvents() |
private final org.springframework.context.ConfigurableApplicationContext context
private final ConcurrentLinkedQueue<org.springframework.context.ApplicationEvent> deferredEvents
public DeferredApplicationEventPublisher(org.springframework.context.ConfigurableApplicationContext context)
public void publishEvent(org.springframework.context.ApplicationEvent event)
publishEvent 在接口中 org.springframework.context.ApplicationEventPublisherpublic void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
onApplicationEvent 在接口中 org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>private void replayDeferredEvents()
public void publishEvent(Object event)
publishEvent 在接口中 org.springframework.context.ApplicationEventPublisherprotected void publishEvent(Object event, @Nullable org.springframework.core.ResolvableType eventType)
Copyright © 2021 Zodiac. All rights reserved.