[
https://issues.apache.org/struts/browse/WW-3127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46212#action_46212
]
Vasiliy Gagin commented on WW-3127:
-----------------------------------
Statement "all Spring beans are proxies" is wrong in general. They are proxies
only if some post-processor "proxied" them. I did not have much experience with
CGLIB.
My guess is that CGLIB does not create a proxy class instead it extends class.
I might be completely wrong on this one. But if I'm right then the autowiring
will work fine for CGLIB proxies.
I just realized that both applyBeanPostProcessorsBeforeInitialization and
applyBeanPostProcessorsAfterInitialization can return proxies.
Method autowireBeanProperties which is subsequently called expects "pure" bean.
I debugged through one of my applications and found out that all of the actions
in my case are "non-proxied". At least from Spring point of view. Struts
creates it's own proxies to them. In my latest app we use
"<tx:annotation-driven> and I was playing with @Transaction on the action. I'm
guessing that combination caused Spring to proxy the Action. And autowiring
failed.
> Autoware fails on proxied objects
> ---------------------------------
>
> Key: WW-3127
> URL: https://issues.apache.org/struts/browse/WW-3127
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Spring
> Affects Versions: 2.1.6
> Reporter: Vasiliy Gagin
>
> com.opensymphony.xwork2.spring.SpringObjectFactory#buildBean method calls
> autoWiringFactory.applyBeanPostProcessorsAfterInitialization() method.
> In some cases this method can return a JDK Proxy instead of action. Following
> call to autoWireBean method attempts to autowire proxy itself instead of the
> action.
> As a result the action remains "not-wired".
> May be autowiring should happen before applying post processors
> "AfterInitialization".
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.