[ 
https://issues.apache.org/jira/browse/WW-4797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart updated WW-4797:
------------------------------
    Fix Version/s: 6.2.0
                       (was: 6.1.0)

> 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
>              Labels: spring-plugin
>             Fix For: 6.2.0
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> {{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
> {code:java}
> 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);
>     }
> {code}
> //orphaned org.apache.struts2.spring.ClassReloadingXMLWebApplicationContext
> org.apache.struts2.spring.ClassReloadingXMLWebApplicationContext:
> {code:java}
> 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();
> }
> {code}
> 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
(v8.20.10#820010)

Reply via email to