which jars are needed for using AspectJ of Spring

2019-05-20 22:30发布

问题:

import org.aspectj.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;
  }
}

回答1:

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.



回答2:

this is link to get jars



回答3:

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



回答4:

You can use this to find jars http://findjar.com



回答5:

aspectj-N.N.NN.jar, where N is the version number. See the AspectJ download site.