You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "zhouyanming (JIRA)" <ji...@apache.org> on 2016/09/30 03:52:21 UTC

[jira] [Commented] (WW-4694) AnnotationWorkflowInterceptor doesn't works with spring proxied action

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

zhouyanming commented on WW-4694:
---------------------------------

I'm open an issue for spring https://jira.spring.io/browse/SPR-14770

> AnnotationWorkflowInterceptor doesn't works with spring proxied action
> ----------------------------------------------------------------------
>
>                 Key: WW-4694
>                 URL: https://issues.apache.org/jira/browse/WW-4694
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>            Reporter: zhouyanming
>
> {code:java}
>     public String intercept(ActionInvocation invocation) throws Exception {
>         final Object action = invocation.getAction();
>         invocation.addPreResultListener(this);
>         List<Method> methods = new ArrayList<>(AnnotationUtils.getAnnotatedMethods(action.getClass(), Before.class));
> {code}
> if action is annotated with @Transactional , AnnotationUtils.getAnnotatedMethods() will always return empty collection.
> here is my quick fix 
> {code:java}
> 	public static Collection<Method> getAnnotatedMethods(Class clazz, Class<? extends Annotation>... annotation){
> 		if( SpringProxy.class.isAssignableFrom(clazz) )
> 			clazz = clazz.getSuperclass();
> {code}
> but it will add spring dependence, I hope there is an elegant way.



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