title: How to make Spring AspectJ annotations work in Java 6/7
body: <p>What changes do I need to make to the below config files to get maven to compile my Java 7 project with Spring Aspects (the one with annotations)?</p>
  
  <pre><code>pom.xml
  webapplicationContext.xml
  etc....
  </code></pre>
  
  <p>Here's my aspect class <em>(it catches the <code>NoResultException</code> from <code>TypedQuery.getSingleResult()</code> and transforms it into a null result value)</em> </p>
  
  <pre><code>package com.example.aspect;
  
  import javax.persistence.NoResultException;
  
  import org.aspectj.lang.ProceedingJoinPoint;
  import org.aspectj.lang.annotation.Around;
  import org.aspectj.lang.annotation.Aspect;
  import org.aspectj.lang.annotation.Pointcut;
  
  @Aspect
  public class NullifyNoResultExceptionAspect {
  
      @Pointcut("execution(public * com.example.dao.impl.*.*(..))")
      public void methodToBeProtected() {}
  
      @Around("methodToBeProtected()")
      public Object queryToProtect(ProceedingJoinPoint pjp) throws Throwable {
          try {
              return pjp.proceed();
          } catch (NoResultException nre) {
              return null;
          }
      }
  
  }
  </code></pre>
  
  <p>I'm using Eclipse Juno sr1 and Java 7 EE.<br>
  My build environment is Maven (2) with a Nexus repository.  </p>