struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wes Wannemacher (JIRA)" <j...@apache.org>
Subject [jira] Commented: (WW-3127) Autoware fails on proxied objects
Date Fri, 15 May 2009 12:37:43 GMT

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

Wes Wannemacher commented on WW-3127:
-------------------------------------

I guess I hadn't really ever considered that Spring wouldn't proxy a class, generally I use
@Transactional and I've used AOP, so any time I've looked at a class in a debugger, it was
proxied... You learn something new every day :)

Anyhow, my understanding of the problem is that Spring tries to stick to JDK dynamic proxies
(when it needs to proxy) which have the limitation that it will only proxy classes that are
implementing an interface. In cases like Struts actions, they are implementing the Action
interface (or not), but that interface exposes no methods. So, I've had problems using any
of the post-processing Spring features (AOP, @Transactional). The suggested solution when
you get this problem is to add CGLIB to your project. With CGLIB, Spring can proxy the target
class, rather than just proxying the classes interfaces. There are limitations to this approach
as well... For instance, a CGLIB proxied bean can't take a constructor argument. The configuration
info is available here - 
http://static.springframework.org/spring/docs/2.5.x/reference/aop.html#aop-proxying

That being said, let's get back to the original problem... In your current project, were the
struts actions proxied? If they were, can you try adding CGLIB and setting the spring configuration
to use it for class-based proxies and then let us know if they are still un-autowired?

> 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.


Mime
View raw message