<dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>5.3.10</version> </dependency> <bean id="myAspect" class="com.example.MyAspect" /> <aop:config> <aop:aspect ref="myAspect"> <aop:pointcut id="myPointcut" expression="execution(* com.example.MyService.*(..))" /> <aop:before method="beforeAdvice" pointcut-ref="myPointcut" /> </aop:aspect> </aop:config> public class MyAspect { public void beforeAdvice() { System.out.println("Before advice is executed."); } }


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