title: Intercept static method with aspectJ
body: <p>I'm using Spring and trying to write my sample application with AspectJ. I need to learn how to intercept static method calls. In my example I'm trying to intercept the main method as follows:</p>
  
  <p>Spring configuration file:</p>
  
  <pre><code>&lt;aop:aspectj-autoproxy /&gt;
  
  &lt;!-- Aspect --&gt;
  &lt;bean id="logAspect" class="com.package.Aspect" /&gt;
  </code></pre>
  
  <p>The main method:</p>
  
  <pre><code>public class App {
      public static void main(String[] args) throws Exception {
  
          ApplicationContext appContext = new ClassPathXmlApplicationContext("Spring-Customer.xml");
  
          System.out.println("str");
      }
  }
  </code></pre>
  
  <p>The asspect itself:</p>
  
  <pre><code>@Aspect
  public class Aspect {
      @Around("execution(*App.main(..))")
      public void logAround(ProceedingJoinPoint joinPoint) throws Throwable {
          System.out.println("Intercepted!");
      }
  
  }
  </code></pre>
  
  <p>But when I run the application, the only <code>str</code> string is being printed.</p>