@Aspect public class LoggingAspect { @Pointcut("execution(* com.example.mylibrary.*.*(..))") public void myPointcut() {} @Before("myPointcut()") public void beforeMethod(JoinPoint joinPoint) { System.out.println("Before method: " + joinPoint.getSignature().getName()); } @After("myPointcut()") public void afterMethod(JoinPoint joinPoint) { System.out.println("After method: " + joinPoint.getSignature().getName()); } } <aspectwerkz> <aspect class="com.example.logging.LoggingAspect"/> </aspectwerkz> @AspectwerkzConfig(value = "META-INF/aspectwerkz.xml") public class MyApplication { // application code }


上一篇:
下一篇:
切换中文