You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Martin Gainty (JIRA)" <ji...@apache.org> on 2017/05/10 14:00:10 UTC
[jira] [Created] (WW-4797) orphaned Factory code never called from
spring-plugin
Martin Gainty created WW-4797:
---------------------------------
Summary: orphaned Factory code never called from spring-plugin
Key: WW-4797
URL: https://issues.apache.org/jira/browse/WW-4797
Project: Struts 2
Issue Type: Task
Components: Plugin - Spring
Affects Versions: 2.3.31
Environment: JDK 1.8
Struts-2.3.4
Maven 3.3.1
Reporter: Martin Gainty
Priority: Minor
org.springframework.beans.BeanWrapper not created in struts-spring-plugin
org.apache.struts2.spring.ClassReloadingBeanFactory contains orphaned createBeanInstance which currently is not implemented in spring plugin
public class ClassReloadingBeanFactory extends org.springframework.beans.factory.support.DefaultListableBeanFactory {
@Override
protected org.springframework.beans.BeanWrapper createBeanInstance(String beanName, org.springframework.beans.factory.support.RootBeanDefinition mbd, Object[] args) {
Class beanClass = resolveBeanClass(mbd, beanName, null);
if (mbd.getFactoryMethodName() != null) {
return instantiateUsingFactoryMethod(beanName, mbd, args);
}
//commented to cached constructor is not used
/* // Shortcut when re-creating the same bean...
if (mbd.resolvedConstructorOrFactoryMethod != null) {
if (mbd.constructorArgumentsResolved) {
return autowireConstructor(beanName, mbd, null, args);
} else {
return instantiateBean(beanName, mbd);
}
}*/
// Need to determine the constructor...
Constructor[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName);
if (ctors != null ||
mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR ||
mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) {
return autowireConstructor(beanName, mbd, ctors, args);
}
// No special handling: simply use no-arg constructor.
return instantiateBean(beanName, mbd);
}
//orphaned org.apache.struts2.spring.ClassReloadingXMLWebApplicationContext
org.apache.struts2.spring.ClassReloadingXMLWebApplicationContext:
setupReloading(...)
{
<snip>
//setup the bean factory
beanFactory = new ClassReloadingBeanFactory();
beanFactory.setInstantiationStrategy(new ClassReloadingInstantiationStrategy());
beanFactory.setBeanClassLoader(classLoader);
/* Where is BeanWrapper created by createBeanInstance& return to client */
//start watch thread
fam.start();
}
this orphaned code contains RootBeanDefiniton parameter org.springframework.beans.factory.support.RootBeanDefinition mbd
which is used to construct class of bean here:
Class beanClass = resolveBeanClass(mbd, beanName, null);
i assume createBeanInstance is implemented in possibly 2.4.x?
Thanks!
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)