List of usage examples for org.springframework.boot.context.event ApplicationPreparedEvent getApplicationContext
public ConfigurableApplicationContext getApplicationContext()
From source file:xolpoc.plugins.StreamPlugin.java
@Override public void preProcessModule(final Module module) { Properties properties = new Properties(); properties.setProperty(XD_STREAM_NAME_KEY, module.getDescriptor().getGroup()); module.addProperties(properties);/*from ww w . j a v a 2 s . c o m*/ if (module.getType() == ModuleType.sink) { module.addListener(new ApplicationListener<ApplicationPreparedEvent>() { @Override public void onApplicationEvent(ApplicationPreparedEvent event) { Properties producerProperties = extractConsumerProducerProperties(module)[1]; MessageBusAwareRouterBeanPostProcessor bpp = new MessageBusAwareRouterBeanPostProcessor( messageBus, producerProperties); bpp.setBeanFactory(event.getApplicationContext().getBeanFactory()); event.getApplicationContext().getBeanFactory().addBeanPostProcessor(bpp); } }); } }
From source file:org.springframework.boot.context.config.ConfigFileEnvironmentPostProcessor.java
@Override public void onApplicationEvent(ApplicationPreparedEvent event) { this.logger.replayTo(ConfigFileEnvironmentPostProcessor.class); addPostProcessors(event.getApplicationContext()); }
From source file:org.springframework.boot.context.logging.LoggingApplicationListener.java
private void onApplicationPreparedEvent(ApplicationPreparedEvent event) { ConfigurableListableBeanFactory beanFactory = event.getApplicationContext().getBeanFactory(); if (!beanFactory.containsBean(LOGGING_SYSTEM_BEAN_NAME)) { beanFactory.registerSingleton(LOGGING_SYSTEM_BEAN_NAME, this.loggingSystem); }//w w w .ja va 2s .com }
From source file:org.springframework.boot.context.properties.migrator.PropertiesMigrationListener.java
private void onApplicationPreparedEvent(ApplicationPreparedEvent event) { ConfigurationMetadataRepository repository = loadRepository(); PropertiesMigrationReporter reporter = new PropertiesMigrationReporter(repository, event.getApplicationContext().getEnvironment()); this.report = reporter.getReport(); }
From source file:org.springframework.boot.devtools.restart.RestartApplicationListener.java
private void onApplicationPreparedEvent(ApplicationPreparedEvent event) { Restarter.getInstance().prepare(event.getApplicationContext()); }