title: Spring AOP aspect with annotations is not working for base class
body: <p>I have annotation defined as below</p>
  
  <pre><code>@Target({ElementType.TYPE, ElementType.METHOD})
  @Retention(RetentionPolicy.RUNTIME)
  @Inherited
  public @interface OTPFlow {
  }
  </code></pre>
  
  <p>And class A defined as below</p>
  
  <pre><code>public abstract class A {
    @OTPFlow
    public ModelAndView doSomething() {
      //do something and return ModelAndView
    }
  }
  </code></pre>
  
  <p>Class B is a controller defined as below</p>
  
  <pre><code>@Controller
  @RequestMapping(value = {"/someurl"})
  public class B extends A {
    @RequestMapping(value = {"/get"}, method = {RequestMethod.POST, RequestMethod.GET})
    public ModelAndView get(HttpServletRequest request, HttpServletResponse response) {
      return doSomething();
    }
  }
  </code></pre>
  
  <p>Aspect is defined as </p>
  
  <pre><code>@Component
  @Aspect
  public class OTPAspect {
  private static final Logger logger = LoggerFactory.getLogger(OTPAspect.class);
  
  @Pointcut("@annotation(OTPFlow)")
  public void OTPFlow() {}
  
  @Around("OTPFlow()")
  public Object checkOTP(ProceedingJoinPoint joinPoint) {
      try {
          logger.info("Inside Aspect");
          return joinPoint.proceed();
      } catch (Throwable e) {
          throw new RuntimeException(e);
      }
  }
  }
  </code></pre>
  
  <p>The problem is when i access "/someurl/get" url, the aspect does not execute. But when i annotate "get" method of class B, aspect executes.</p>
  
  <p>So basically, annotated methods of superclass does not invoke Aspect.</p>
  
  <p>What is the issue? Is there any other way to achieve this? Any help would be appreciated. Thanks</p>