Spring Aspectj LoadTimeWeaving不起作用

时间:2015-06-05 06:44:46

标签: java spring aspectj load-time-weaving

我在使用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

没有编课。

我错过了什么吗?

0 个答案:

没有答案