Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.context.weaving;
|
package org.springframework.context.weaving;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.instrument.ClassFileTransformer;
|
import java.lang.instrument.ClassFileTransformer;
|
||||||
import java.lang.instrument.IllegalClassFormatException;
|
import java.lang.instrument.IllegalClassFormatException;
|
||||||
import java.security.ProtectionDomain;
|
import java.security.ProtectionDomain;
|
||||||
@@ -44,12 +43,13 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||||||
public class AspectJWeavingEnabler
|
public class AspectJWeavingEnabler
|
||||||
implements BeanFactoryPostProcessor, BeanClassLoaderAware, LoadTimeWeaverAware, Ordered {
|
implements BeanFactoryPostProcessor, BeanClassLoaderAware, LoadTimeWeaverAware, Ordered {
|
||||||
|
|
||||||
|
public static final String ASPECTJ_AOP_XML_RESOURCE = "META-INF/aop.xml";
|
||||||
|
|
||||||
|
|
||||||
private ClassLoader beanClassLoader;
|
private ClassLoader beanClassLoader;
|
||||||
|
|
||||||
private LoadTimeWeaver loadTimeWeaver;
|
private LoadTimeWeaver loadTimeWeaver;
|
||||||
|
|
||||||
public static final String ASPECTJ_AOP_XML_RESOURCE = "META-INF/aop.xml";
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||||
@@ -71,6 +71,12 @@ public class AspectJWeavingEnabler
|
|||||||
enableAspectJWeaving(this.loadTimeWeaver, this.beanClassLoader);
|
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) {
|
public static void enableAspectJWeaving(LoadTimeWeaver weaverToUse, ClassLoader beanClassLoader) {
|
||||||
if (weaverToUse == null) {
|
if (weaverToUse == null) {
|
||||||
if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
|
if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
|
||||||
@@ -80,8 +86,8 @@ public class AspectJWeavingEnabler
|
|||||||
throw new IllegalStateException("No LoadTimeWeaver available");
|
throw new IllegalStateException("No LoadTimeWeaver available");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
weaverToUse.addTransformer(new AspectJClassBypassingClassFileTransformer(
|
weaverToUse.addTransformer(
|
||||||
new ClassPreProcessorAgentAdapter()));
|
new AspectJClassBypassingClassFileTransformer(new ClassPreProcessorAgentAdapter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -108,4 +114,5 @@ public class AspectJWeavingEnabler
|
|||||||
return this.delegate.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
|
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 nested type of the method/constructor parameter.
|
||||||
* @return the parameter type (never {@code null})
|
* @return the parameter type (never {@code null})
|
||||||
* @see #getNestingLevel()
|
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
* @see #getNestingLevel()
|
||||||
*/
|
*/
|
||||||
public Class<?> getNestedParameterType() {
|
public Class<?> getNestedParameterType() {
|
||||||
if (this.nestingLevel > 1) {
|
if (this.nestingLevel > 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user