<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.3.5</version>
</dependency>
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
public class LoggingAspect {
@Before("execution(* com.example.MyClass.myMethod(..))")
public void beforeAdvice() {
System.out.println("Before advice executed!");
}
}
<aop:aspectj-autoproxy/>
<bean id="loggingAspect" class="com.example.LoggingAspect"/>