title: Load time weaving for non-spring beans in a spring application
body: <p>I have a spring boot application with some REST controllers, service classes and helper classes. The controllers and service classes are spring managed while helper classes are not spring managed and mostly contain static methods. </p>
  
  <p>The AspectJ configuration is present in java configuration as follows</p>
  
  <pre><code>@Configuration
  @EnableLoadTimeWeaving(aspectjWeaving = AspectJWeaving.ENABLED)
  public class AspectConfig {
  
      @Bean
      public LoggingAspect loggingAspect() {
          return new LoggingAspect();
      }
  }
  </code></pre>
  
  <p>The corresponding LoggingAspect class is as follows,</p>
  
  <pre><code>@Aspect
  public class LoggingAspect {
  
      @Before("allMethodsPointcut()")
      public void logBeforeMethod(JoinPoint joinPoint) {
          System.out.println("Entering Method - " + joinPoint.getSignature().getDeclaringType() + "::" + joinPoint.getSignature().getName());
      }
  
      @After("allMethodsPointcut()")
      public void logAfterMethod(JoinPoint joinPoint) {
          System.out.println("Exiting Method - " + joinPoint.getSignature().getDeclaringType() + "::" + joinPoint.getSignature().getName());
      }
  
      @Pointcut("execution(* com.test.controller..*(..)) || execution(* com.test.service..*(..)) || execution(* com.test.helper..*(..))")
      public void allMethodsPointcut() {
      }
  }
  </code></pre>
  
  <ul>
  <li>When the controller is called, the Aspect enabled logging works for the controller and service functions but not for the helper functions.</li>
  <li>If we autowire the helper class in the controller, the non-static helper methods start showing the aspectj logs. However, the static helper methods still do not show the aspectj logs</li>
  </ul>
  
  <p>Questions,
  1. How can we configure the aspectj advice for classes which are not spring managed i.e. without @Bean, @Autowired, @Component etc.
  2. How can we configure aspectj advice for static methods (I am using @EnableLoadTimeWeaving but maybe i am missing something)
  3. AspectJ configuration should be java based if possible</p>
  
  <p>Kindly let me know if more details are required</p>