title: Aspect deactivates Spring Controller Mapping
body: <p>I created a Spring website.
  I used an abstract generic controller class, with different implementations.
  It works well if I don't activate the Aspect class on any Controllers.</p>
  
  <p>If I activate an Aspect, then all Mappings seem to be deactivated: </p>
  
  <blockquote>
    <p>DEBUG: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Did not find handler method for [/contact/2]<br>
    WARN : org.springframework.web.servlet.PageNotFound - No mapping found forHTTP request with URI [/clubhelperbackend/contact/2] in DispatcherServlet with name 'appServlet'</p>
  </blockquote>
  
  <p>This is my abstract controller:</p>
  
  <pre><code>public abstract class AbstractController&lt;T extends Data&gt; implements ClubController&lt;T&gt; {
  
  protected Dao&lt;T&gt; dao;
  private Class&lt;T&gt; elementClass;
  
  public AbstractController(Dao&lt;T&gt; dao, Class&lt;T&gt; element) {
      super();
      this.dao = dao;
      this.elementClass = element;
  }
  
  @Override
  @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  public String getAsView(@PathVariable("id") long id, @RequestParam(required = false) boolean ajax, Model m) {
      String mapping = elementClass.getSimpleName();
      m.addAttribute(mapping, getById(id));
      return mapping + "Get" + (ajax ? "Ajax" : "");
  }
  
  @Override
  @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "application/json")
  public T delete(@PathVariable("id") long id) {
      T obj = getById(id);
      // dao.delete(id);
      return obj;
  }
  }
  </code></pre>
  
  <p>And an implementation:</p>
  
  <pre><code>@Controller
  @RequestMapping("/contact")
  public class ContactController extends AbstractController&lt;Contact&gt; {
  
      @Autowired
      public ContactController(Dao&lt;Contact&gt; contactDao) {
          super(contactDao, Contact.class);
      }
  
  }
  </code></pre>
  
  <p>This is my Aspect:</p>
  
  <pre><code>@Aspect
  @Component
  public class DeletedStorageAspect {
      //
      // private DeletedEntriesDao deletedEntriesDao;
      //
      // @Autowired
      // public DeletedStorageAspect(DeletedEntriesDao deletedEntriesDao) {
      // super();
      // this.deletedEntriesDao = deletedEntriesDao;
      // }
  
      @Pointcut("execution (public * de.kreth.clubhelperbackend.controller.abstr.AbstractController.delete(..))")
      private void invocation() {
      }
  
      @AfterReturning(pointcut = "invocation()", returning = "deleted")
      public void storeDeleted(JoinPoint joinPoint, Data deleted) {
          System.out.println("Deleted: " + deleted);
          String tableName = deleted.getClass().getSimpleName();
          long id = deleted.getId();
          Date now = new Date();
          DeletedEntries entry = new DeletedEntries(-1L, tableName, id, now, now);
          System.out.println(entry);
          // deletedEntriesDao.insert(entry);
      }
  }
  </code></pre>
  
  <p>This is part of my beans.xml:</p>
  
  <pre><code>&lt;aop:aspectj-autoproxy&gt;
      &lt;aop:include name="mysqlDbCheckAspect" /&gt;
      &lt;aop:include name="daoLoggerAspect" /&gt;
      &lt;aop:include name="controllerSecurityAspect" /&gt;
      &lt;aop:include name="deletedStorageAspect" /&gt;
  &lt;/aop:aspectj-autoproxy&gt;
  </code></pre>
  
  <p>I can restore full functionality by commenting deletedStorageAspect.</p>
  
  <p>What causes this behaviour? Why are the mappings not recognized with an aspect on them? Are aspects not allowed on Controllers?</p>
  
  <p>Hoping for some help, please.</p>