提交 a2aa82eb 编写于 作者: J Juergen Hoeller

Polishing

上级 981d4494
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -16,7 +16,6 @@
package org.springframework.context.weaving;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;
......@@ -44,12 +43,13 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
public class AspectJWeavingEnabler
implements BeanFactoryPostProcessor, BeanClassLoaderAware, LoadTimeWeaverAware, Ordered {
public static final String ASPECTJ_AOP_XML_RESOURCE = "META-INF/aop.xml";
private ClassLoader beanClassLoader;
private LoadTimeWeaver loadTimeWeaver;
public static final String ASPECTJ_AOP_XML_RESOURCE = "META-INF/aop.xml";
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
......@@ -71,6 +71,12 @@ public class AspectJWeavingEnabler
enableAspectJWeaving(this.loadTimeWeaver, this.beanClassLoader);
}
/**
* Enable AspectJ weaving with the given {@link LoadTimeWeaver}.
* @param weaverToUse the LoadTimeWeaver to apply to (or {@code null} for a default weaver)
* @param beanClassLoader the class loader to create a default weaver for (if necessary)
*/
public static void enableAspectJWeaving(LoadTimeWeaver weaverToUse, ClassLoader beanClassLoader) {
if (weaverToUse == null) {
if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
......@@ -80,8 +86,8 @@ public class AspectJWeavingEnabler
throw new IllegalStateException("No LoadTimeWeaver available");
}
}
weaverToUse.addTransformer(new AspectJClassBypassingClassFileTransformer(
new ClassPreProcessorAgentAdapter()));
weaverToUse.addTransformer(
new AspectJClassBypassingClassFileTransformer(new ClassPreProcessorAgentAdapter()));
}
......@@ -108,4 +114,5 @@ public class AspectJWeavingEnabler
return this.delegate.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
}
}
}
......@@ -394,8 +394,8 @@ public class MethodParameter {
/**
* Return the nested type of the method/constructor parameter.
* @return the parameter type (never {@code null})
* @see #getNestingLevel()
* @since 3.1
* @see #getNestingLevel()
*/
public Class<?> getNestedParameterType() {
if (this.nestingLevel > 1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册