List of usage examples for org.springframework.context Lifecycle start
void start();
From source file:org.brekka.stillingar.spring.snapshot.SnapshotDeltaValueInterceptor.java
protected void initializeBean(Object value) { if (value instanceof InitializingBean) { InitializingBean initializingBean = (InitializingBean) value; if (log.isInfoEnabled()) { log.info(String.format("Starting InitializingBean: %s", value)); }//from w w w . j a v a 2 s . c om try { initializingBean.afterPropertiesSet(); } catch (Exception e) { throw new ConfigurationException(String.format("Failed to initialize bean '%s'", value), e); } } else if (value instanceof Lifecycle) { Lifecycle lifecycle = (Lifecycle) value; if (log.isInfoEnabled()) { log.info(String.format("Starting Lifecycle bean: %s", value)); } lifecycle.start(); } }
From source file:org.springframework.context.support.DefaultLifecycleProcessor.java
/** * Start the specified bean as part of the given set of Lifecycle beans, * making sure that any beans that it depends on are started first. * @param lifecycleBeans Map with bean name as key and Lifecycle instance as value * @param beanName the name of the bean to start *///from w w w . jav a2 s. com private void doStart(Map<String, ? extends Lifecycle> lifecycleBeans, String beanName, boolean autoStartupOnly) { Lifecycle bean = lifecycleBeans.remove(beanName); if (bean != null && !this.equals(bean)) { String[] dependenciesForBean = getBeanFactory().getDependenciesForBean(beanName); for (String dependency : dependenciesForBean) { doStart(lifecycleBeans, dependency, autoStartupOnly); } if (!bean.isRunning() && (!autoStartupOnly || !(bean instanceof SmartLifecycle) || ((SmartLifecycle) bean).isAutoStartup())) { if (logger.isDebugEnabled()) { logger.debug("Starting bean '" + beanName + "' of type [" + bean.getClass() + "]"); } try { bean.start(); } catch (Throwable ex) { throw new ApplicationContextException("Failed to start bean '" + beanName + "'", ex); } if (logger.isDebugEnabled()) { logger.debug("Successfully started bean '" + beanName + "'"); } } } }
From source file:org.springframework.data.hadoop.config.common.annotation.configuration.AutowireBeanFactoryObjectPostProcessor.java
@Override public void start() { running = true; for (Lifecycle bean : lifecycleBeans) { bean.start(); } }
From source file:org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor.java
public void start() { for (Lifecycle lifecycle : this.lifecycles) { if (!lifecycle.isRunning()) { lifecycle.start(); }/* w ww .j ava 2s . c o m*/ } this.running = true; }
From source file:org.springframework.statemachine.processor.StateMachineAnnotationPostProcessor.java
@Override public void start() { for (Lifecycle lifecycle : this.lifecycles) { if (!lifecycle.isRunning()) { lifecycle.start(); }//from ww w.j ava 2s . co m } this.running = true; }