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

Yasser Zamani commented on WW-4694:
-----------------------------------

Spring has to do a lot of annotation processing itself in order to navigate its 
way around proxies, superclasses, interfaces and so. The logic for doing this 
is encapsulated and exposed in the 
+org.springframework.core.annotation.AnnotationUtils+ class. In your case, *it 
sounds like we can* rewrite something like Spring's +findAnnotation+ utility 
method and use it inside iteration of our +getAnnotatedMethods+ to navigate 
around proxies and so like Spring itself do.

I will be working on it, [~lukaszlenart].

> 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
>             Fix For: 2.5.x
>
>
> {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.15#6346)

Reply via email to