Spring AOP pointcut (Defines where aspects get applied within your application - location shower)
@Aspect
@Component
public class MyPointcut {
@Pointcut("execution(* com.example.service.*.save*(..))")
public void saveMethods() {}
}
@Aspect
@Component
public class LoggingAspect {
@Before("MyPointcut.saveMethods()") // Apply before the pointcut
public void logSaveOperation(JoinPoint joinPoint) {
System.out.println("Logging before saving something with: " + joinPoint.getSignature().getName());
}
}
#FabianTechSolutions #DevTeam
コメント