You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/12/13 17:52:59 UTC
svn commit: r1045229 -
/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/RestrictedLifeCycleBeanPostProcessor.java
Author: norman
Date: Mon Dec 13 16:52:59 2010
New Revision: 1045229
URL: http://svn.apache.org/viewvc?rev=1045229&view=rev
Log:
Just some adjustment to make it easier to work with spring-dm extender. See JAMES-910
Modified:
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/RestrictedLifeCycleBeanPostProcessor.java
Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/RestrictedLifeCycleBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/RestrictedLifeCycleBeanPostProcessor.java?rev=1045229&r1=1045228&r2=1045229&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/RestrictedLifeCycleBeanPostProcessor.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/RestrictedLifeCycleBeanPostProcessor.java Mon Dec 13 16:52:59 2010
@@ -19,23 +19,24 @@
package org.apache.james.container.spring.lifecycle;
import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.ListableBeanFactory;
/**
- * {@link AbstractLifeCycleBeanPostProcessor} sub-class which will only try to apply LifeCycle callbacks on beans which are registered on the {@link ApplicationContext}.
+ * {@link AbstractLifeCycleBeanPostProcessor} sub-class which will only try to apply LifeCycle callbacks on beans which are registered on the {@link BeanFactory}.
*
*
* @param <T>
*/
-public abstract class RestrictedLifeCycleBeanPostProcessor<T> extends AbstractLifeCycleBeanPostProcessor<T> implements ApplicationContextAware{
+public abstract class RestrictedLifeCycleBeanPostProcessor<T> extends AbstractLifeCycleBeanPostProcessor<T> implements BeanFactoryAware{
- private ApplicationContext context;
+ private ListableBeanFactory factory;
@Override
protected final void executeLifecycleMethodAfterInit(T bean, String beanname) throws Exception {
// check if the bean is registered in the context. If not it was create by the InstanceFactory and so there is no need to execute the callback
- if (context.containsBeanDefinition(beanname)) {
+ if (factory.containsBeanDefinition(beanname)) {
executeLifecycleMethodAfterInitChecked(bean, beanname);
}
}
@@ -43,17 +44,18 @@ public abstract class RestrictedLifeCycl
@Override
protected final void executeLifecycleMethodBeforeInit(T bean, String beanname) throws Exception {
// check if the bean is registered in the context. If not it was create by the InstanceFactory and so there is no need to execute the callback
- if (context.containsBeanDefinition(beanname)) {
+ if (factory.containsBeanDefinition(beanname)) {
executeLifecycleMethodBeforeInitChecked(bean, beanname);
}
}
+
/*
* (non-Javadoc)
- * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
+ * @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
*/
- public void setApplicationContext(ApplicationContext context) throws BeansException {
- this.context = context;
+ public void setBeanFactory(BeanFactory factory) throws BeansException {
+ this.factory = (ListableBeanFactory) factory;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org