struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CRANFORD, CHRIS" <Chris.Cranf...@setech.com>
Subject Spring BeanPostProcessor called twice for Struts managed beans
Date Thu, 15 Oct 2015 04:57:40 GMT
In a recent BeanPostProcessor implementation, I noticed our logic was being invoked twice in
both the before and after initialization callbacks for struts constructed objects like actions,
interceptors, etc while normal constructed Spring beans via component scanning were only being
invoked once.

After debugging in 3.2.24.1, I narrowed the issue down to the SpringObjectFactory implementation
in Xwork2 at lines 194 to 197.  It seems XWork's implementation manually calls the before
and after BeanPostProcessor callbacks.  Looking at the Spring source for AbstractAutowireCapableBeanFactory,
it seems initializeBean's implementation also calls these callback methods too, which is what
leads to re-evaluating the struts constructed objects twice.

I believe the plugin is based on Spring 3.0.5 (IIRC) and even reviewing the code base at that
release along with the latest 4.2.1 release, both confirm that initializeBean has always invoked
the BeanPostProcessor callbacks internally and therefore, XWork's implementation really should
not worry with manually invoking them too.

Is there a technical reason why the SpringObjectFactory is doing this or is this an oversight?
 
This just seems like a significant overhead on bean management that could be avoided, right?

Thanks,
Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message