You can implement many crosscutting behaviors in Spring Boot with @Aspect, @Before, or @Around—without using native AspectJ weaving. In that common setup, Spring AOP intercepts method calls to Spring-managed beans through proxies. Choose native AspectJ compile-time or load-time weaving when you need interception beyond those proxy boundaries, such as field access, object construction, or internal method calls.
Spring AOP or native AspectJ: choose by the join point you need
The words “AspectJ support” can refer to annotation syntax, not necessarily to AspectJ’s compiler or weaver. Spring supports the @AspectJ annotation style and parses AspectJ pointcut expressions, while the runtime can remain Spring AOP. As the Spring Framework @AspectJ support documentation explains, the annotations alone do not mean the AspectJ compiler or weaver is being used.
| Decision | Spring AOP with @AspectJ annotations | Native AspectJ weaving |
|---|---|---|
| How advice runs | At runtime, through proxies around Spring beans | Bytecode is woven at compile time or when classes load |
| Typical join points | Method executions on Spring-managed beans | A broader AspectJ model, including calls, fields, and constructors |
| Calls within the same object | Self-invocation bypasses the proxy | Applicable join points can be woven |
| Setup | Spring Boot auto-configuration and an aspect bean | Compiler or weaving-agent configuration; packaging and runtime setup need validation |
| Good fit | Behavior applied at Spring bean method boundaries | Non-Spring objects or interception needs beyond proxyable method executions |
For tracing, timing, or policy checks on calls entering service beans, Spring AOP is usually the simpler fit. If the requirement concerns construction, field get/set, a call site, or a same-object method call, Spring’s proxy-based AOP does not provide that join point; assess native weaving instead. Spring describes the two technologies as complementary options in its AOP overview.
How Spring Boot enables Spring AOP
Spring Boot provides AOP auto-configuration. Its AOP reference documents CGLIB proxying as the default and the property spring.aop.proxy-target-class=false for choosing JDK dynamic proxies. When AspectJ is on the classpath, Boot automatically enables AspectJ auto-proxying; with that setup, you do not need to add @EnableAspectJAutoProxy.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Add the Spring AOP support appropriate to the Spring Boot release selected by your project, using that release’s dependency management. The exact starter artifact name can vary between Boot generations, so check the dependency documentation for your release rather than copying an unversioned coordinate from a different project.
Declare an aspect and keep its pointcut narrow
An aspect must itself be a Spring bean, discovered by component scanning or registered explicitly. The following illustrative example times executions of methods in a service package. It demonstrates Spring AOP mechanics; it is not a production-tested timing implementation.
Rank #2
package com.example.monitoring;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class ServiceTimingAspect {
@Pointcut("execution(* com.example.service..*(..))")
public void serviceMethods() {
}
@Around("serviceMethods()")
public Object timeServiceCall(ProceedingJoinPoint joinPoint) throws Throwable {
long start = System.nanoTime();
try {
return joinPoint.proceed();
} finally {
long elapsedNanos = System.nanoTime() - start;
System.out.println(joinPoint.getSignature() + " took " + elapsedNanos + " ns");
}
}
}
In a real application, replace the example output with the project’s logging or metrics mechanism and decide how to treat exceptions and sensitive method data. Keep pointcuts anchored to application packages or a purpose-built annotation. A pointcut that matches every method can capture framework and infrastructure calls as well as application code.
Spring AOP supports designators such as execution, within, and @annotation, along with Spring’s bean designator. Its supported set is not the full native AspectJ language: expressions using call, get, set, constructor-related designators, or cflow are not supported for Spring AOP proxy matching. See Spring’s pointcut documentation before reusing a pointcut written for native weaving.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #3
Invoke the method through the Spring proxy
Proxy-based advice runs only when the call passes through the Spring-managed proxy. Inject the service into another Spring bean and call the matched method on that injected reference. Directly constructing a service with new does not create a Spring proxy, and a method calling another method on the same target object does not re-enter its proxy. That self-invocation is a common reason advice fails to run even though the application starts normally.
Choose JDK or CGLIB proxies deliberately
Spring AOP can use JDK dynamic proxies, which expose interfaces, or CGLIB subclass proxies. Spring Boot defaults to CGLIB; set spring.aop.proxy-target-class=false when you want JDK proxies. With JDK proxies, inject and use the service interface where the proxy is exposed. With CGLIB, the target must be subclassable: final classes cannot be subclassed, and final or private methods cannot be overridden for advice. Spring details these constraints in its proxying mechanisms documentation.
Rank #4
When native AspectJ weaving is necessary
Use compile-time or load-time weaving when the design requires join points Spring proxies cannot intercept—for example, field access, constructors, call sites, or behavior that must apply to internal calls on an object. Native weaving has separate compiler or class-loading setup and deployment implications; Spring documents its integration and configuration in the AspectJ integration guide. Do not assume adding @Aspect or an AspectJ-related dependency by itself configures native weaving.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools

