title: Spring AOP: Capture inner private method calls (@EnableAspectJAutoProxy)
body: <p>I need to capture private inner calling methods.</p>
  
  <p>So, I need to use aspectj weaving into my spring-boot project:</p>
  
  <pre><code>@Configuration
  @EnableAspectJAutoProxy
  public class ApiConfiguration implements WebMvcConfigurer { /*...*/ }
  </code></pre>
  
  <p>I need to capture a <code>@Service</code> <strong>private</strong> method execution:</p>
  
  <pre><code>package net.space.service;
  
  // imports
  
  @Service    
  public class RepositoryService {
      private void privateMethod(String param) {
          /* Do something */
      }
  
      public void innerCaller() {
          this.privateMethod(null);
      }
  }
  </code></pre>
  
  <p><strong>IMPORTANT</strong>: <code>privateMethod</code> is <strong>private</strong> and is called only by <code>innerCaller</code>.</p>
  
  <p>However, advice is never reached. How could I solve that?</p>
  
  <p>I've also tried with this pointcut:</p>
  
  <pre><code>@Pointcut(value = "execution(* privateMethod(..))")
  public void privatePointcut() {
  }
  </code></pre>
  
  <p>and advice:</p>
  
  <pre><code>@AfterReturning("privatePointcut()")
  public void groupMetrics(JoinPoint point) throws Throwable {
      // Do something
  }
  </code></pre>
  
  <p>I've also tried with:</p>
  
  <pre><code>@Pointcut(value = "execution(* net.space.service.RepositoryService.privateMethod(..))")
  @Pointcut(value = "execution(* RepositoryService.privateMethod(..))")
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've also tried to use <code>@EnableLoadTimeWeaving</code>:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver' defined in class path resource [org/springframework/context/annotation/LoadTimeWeavingConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.instrument.classloading.LoadTimeWeaver]: Factory method 'loadTimeWeaver' threw exception; nested exception is java.lang.IllegalStateException: ClassLoader [sun.misc.Launcher$AppClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]</p>
  </blockquote>