<dependency> <groupId>org.apache.servicemix.bundles</groupId> <artifactId>org.apache.servicemix.bundles.aspectj</artifactId> <version>x.x.x</version> </dependency> import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; @Aspect public class LoggingAspect { @Before("execution(* com.example.service.MyService.*(..))") public void beforeAdvice() { System.out.println("Before MyService method execution"); } } <bean id="loggingAspect" class="com.example.aspect.LoggingAspect"/> <aop:aspectj-autoproxy> <aop:include name="loggingAspect"/> </aop:aspectj-autoproxy>


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