Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4694

AnnotationWorkflowInterceptor doesn't work with spring proxied action

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.12
    • Component/s: Core
    • Labels:
      None

      Description

          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));
      

      if action is annotated with @Transactional , AnnotationUtils.getAnnotatedMethods() will always return empty collection.
      here is my quick fix

      	public static Collection<Method> getAnnotatedMethods(Class clazz, Class<? extends Annotation>... annotation){
      		if( SpringProxy.class.isAssignableFrom(clazz) )
      			clazz = clazz.getSuperclass();
      

      but it will add spring dependence, I hope there is an elegant way.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                quaff Yanming Zhou
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: