<dependency> <groupId>com.nepxion</groupId> <artifactId>matrix-aop-starter</artifactId> <version>x.x.x</version> </dependency> @Aspect @Component public class LoggingAspect { @Before("execution(* com.example.service.*.*(..))") public void logBefore(JoinPoint joinPoint) { } @After("execution(* com.example.service.*.*(..))") public void logAfter(JoinPoint joinPoint) { } @AfterThrowing(pointcut = "execution(* com.example.service.*.*(..))", throwing = "ex") public void logAfterThrowing(JoinPoint joinPoint, Exception ex) { } } properties matrix.aop.starter.patterns=com.example.service..* matrix.aop.starter.classes=com.example.aspect.LoggingAspect @SpringBootApplication @EnableMatrixAop public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }


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