I have the following spring configuration:
For Spring Boot to use @Autowired with AspectJ I have found the following method. In configuration class add your aspect:
@Configuration
@ComponentScan("com.kirillch.eqrul")
public class AspectConfig {
@Bean
public EmailAspect theAspect() {
EmailAspect aspect = Aspects.aspectOf(EmailAspect.class);
return aspect;
}
}
Then you can successfully autowire your services in your aspect class:
@Aspect
public class EmailAspect {
@Autowired
EmailService emailService;