Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Problems with Struts 2 and Spring AOP Resources

André Faria

2007-01-05


Hi All,

  I dont know exactly why but when I use Acegi Security with Spring
AOP Interceptors that transforms the class with CGLib the Struts 2
creates the Action, calls the class constructor two times...
I think that this effect is associated with the fact that the of the
class changes after CGLib work. If someone have a light, peaple help-me.


Thats happen here:

Class com.opensymphony.xwork2.spring.SpringObjectFactory

  public Object buildBean(Class clazz, Map extraContext) throws
Exception {
    Object bean;

    try {
       bean = autoWiringFactory.autowire(clazz,
AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false); //Creates First
Time
    } catch (UnsatisfiedDependencyException e) {
       // Fall back
       bean = super.buildBean(clazz, extraContext);
    }

    bean =
autoWiringFactory.applyBeanPostProcessorsBeforeInitialization(bean,
bean.getClass().getName());
    // We don't need to call the init-method since one won't be
registered.
    bean =
autoWiringFactory.applyBeanPostProcessorsAfterInitialization(bean,
bean.getClass().getName()); //Creates Second Time
    return autoWireBean(bean, autoWiringFactory);
  }

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.