import org.aspect开发者_StackOverflow中文版j.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.ProceedingJoinPoint;
@Aspect
public class AroundExample {
@Around("com.xyz.myapp.SystemArchitecture.businessService()")
public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable {
// start stopwatch
Object retVal = pjp.proceed();
// stop stopwatch
return retVal;
}
}
You will need current version of aspectj jars i.e. aspectjrt-1.6.6.jar
and aspectjweaver-1.7.2.jar
with other jars shown in the below image to work with AspectJ of Spring framework.
The link provided in the accepted answer didn't work for me. So I had to get the jar from somewhere else. This is the LINK
The file is aspectjrt-1.6.6.jar
this is link to get jars
You can use this to find jars http://findjar.com
aspectj-N.N.NN.jar
, where N is the version number. See the AspectJ download site.
精彩评论