0

我在使用 AspectJ LoadTimeWeaving 编织方面时遇到问题

这是方面:

package com.thomson.tgr.aspects;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.util.StopWatch;

@Aspect
public class PerformanceAspect {

@Around("methodsToBeProfiled()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
    StopWatch sw = new StopWatch(getClass().getSimpleName());
    try {
        sw.start(pjp.getSignature().getName());
        return pjp.proceed();
    } finally {
        sw.stop();
        System.out.println("asdfasdf" + sw.prettyPrint());
    }
}

@Pointcut("execution(* *.*(..))")
public void methodsToBeProfiled(){}

}

这是 aop.xml

<!DOCTYPE aspectj PUBLIC
    "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">

<weaver options="-verbose -debug -showWeaveInfo">        
    <include within="com..*"/>

</weaver>

<aspects>

    <!-- weave in just this aspect -->
    <aspect name="com.xxx.tgr.aspects.PerformanceAspect"/>

</aspects>

我已经添加

<context:load-time-weaver /> 

到我的 bean 定义。

我加了

-javaagent:"C:/Users/UC193514/Desktop/aspectjweaver-1.7.0.jar"
-javaagent:"C:/Users/UC193514/Desktop/spring-instrument-3.2.7.RELEASE.jar"

到 JVM 参数。

我在日志中看到的与编织有关的所有内容是:

[WebappClassLoader@1ce4a8a] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified

没有类被编织。

我错过了什么吗??

4

0 回答 0