本文整理了Java中org.springframework.context.event.ContextRefreshedEvent.getSource()
方法的一些代码示例,展示了ContextRefreshedEvent.getSource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ContextRefreshedEvent.getSource()
方法的具体详情如下:
包路径:org.springframework.context.event.ContextRefreshedEvent
类名称:ContextRefreshedEvent
方法名:getSource
暂无
代码示例来源:origin: org.springframework.boot/spring-boot
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext context = event.getApplicationContext();
if (context instanceof ConfigurableApplicationContext
&& context == event.getSource()) {
context.publishEvent(new ParentContextAvailableEvent(
(ConfigurableApplicationContext) context));
}
}
代码示例来源:origin: Kixeye/chassis
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
logger.debug("Received ContextRefreshedEvent {}", event);
if (event.getSource().equals(getBootstrapApplicationContext())) {
//the root context is fully started
appMetadata = bootstrapApplicationContext.getBean(AppMetadata.class);
configuration = bootstrapApplicationContext.getBean(AbstractConfiguration.class);
configurationProvider = bootstrapApplicationContext.getBean(ConfigurationProvider.class);
logger.debug("Root context started");
initClientApplication();
return;
}
if (event.getSource() instanceof ApplicationContext && ((ApplicationContext) event.getSource()).getId().equals(appMetadata.getName())) {
//the child context is fully started
this.applicationContext = (AbstractApplicationContext) event.getSource();
logger.debug("Child context started");
}
state.compareAndSet(State.STARTING, State.RUNNING);
}
代码示例来源:origin: spring-cloud/spring-cloud-stream
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
ConfigurableApplicationContext source = (ConfigurableApplicationContext) event.getSource();
if (source == this.applicationContext && !source.isRunning()) {
source.start();
}
}
}
代码示例来源:origin: io.macgyver/macgyver-core
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
try {
if (kernel.getApplicationContext() != event.getSource()) {
return;
}
logger.info("STARTED: {}", event);
registry.startAfterSpringContextInitialized();
runInitScripts();
}
catch (IOException e) {
throw new MacGyverException(e);
}
}
代码示例来源:origin: ralscha/extdirectspring
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext context = (ApplicationContext) event.getSource();
代码示例来源:origin: org.springframework.cloud/spring-cloud-stream-metrics
public void onApplicationEvent(ContextRefreshedEvent event) {
this.exportProperties.clear();
ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) event.getSource();
ConfigurableEnvironment environment = ctx.getEnvironment();
BeanExpressionResolver beanExpressionResolver = ctx.getBeanFactory().getBeanExpressionResolver();
内容来源于网络,如有侵权,请联系作者删除!