struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4554) Spring BeanPostProcessor(s) are called twice for Struts constructed objects.
Date Tue, 27 Oct 2015 08:54:28 GMT

    [ https://issues.apache.org/jira/browse/WW-4554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14976036#comment-14976036
] 

Hudson commented on WW-4554:
----------------------------

SUCCESS: Integrated in Struts-JDK6-support-2.3 #925 (See [https://builds.apache.org/job/Struts-JDK6-support-2.3/925/])
WW-4554 Drops duplicated calls to initialize BeanPostProcessors  It's (lukaszlenart: rev 7848534e2f2a8cf4aa956d27b6cf672f36cfacfe)
* xwork-core/src/main/java/com/opensymphony/xwork2/spring/SpringObjectFactory.java


> Spring BeanPostProcessor(s) are called twice for Struts constructed objects.
> ----------------------------------------------------------------------------
>
>                 Key: WW-4554
>                 URL: https://issues.apache.org/jira/browse/WW-4554
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Spring
>    Affects Versions: 2.3.24
>            Reporter: Chris Cranford
>             Fix For: 2.3.25, 2.5
>
>
> It appears that the SpringObjectFactory in the xwork core at lines 194-197 manually yet
when calling initializeBean on the autowire factory, the spring framework automatically invokes
these processors too which lead to the following post processor's callbacks being invoked
twice for both the before and after handlers.  
> I confirmed that both Sprnig 3.0.5 and 4.2.1 have called the bean post processors when
the initializeBean function is called.  See a simple NullBeanPostProcessor implementation
below that can be used as a simple test of post processor invocation.
> {code:title=NullBeanPostProcessor.java|borderStyle=solid}
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> import org.springframework.beans.BeansException;
> import org.springframework.beans.factory.config.BeanPostProcessor;
> /**
>  * @since	7.0.0
>  */
> public class NullBeanPostProcessor implements BeanPostProcessor {
> 	private static final Logger LOGGER = LoggerFactory.getLogger(NullBeanPostProcessor.class);
> 	
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	@Override
> 	public Object postProcessBeforeInitialization(Object bean, String beanName)
> 	throws BeansException {
> 		LOGGER.debug("Before Initialization for {} ({})", beanName, bean);
> 		return bean;
> 	}
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	@Override
> 	public Object postProcessAfterInitialization(Object bean, String beanName)
> 	throws BeansException {
> 		LOGGER.debug("After Initialization for {} ({})", beanName, bean);
> 		return bean;
> 	}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message