|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2018 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. |
|
|
|
@ -32,11 +32,10 @@ import org.springframework.util.Assert; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Utility class for handling registration of AOP auto-proxy creators. |
|
|
|
* Utility class for handling registration of AOP auto-proxy creators. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Only a single auto-proxy creator can be registered yet multiple concrete |
|
|
|
* <p>Only a single auto-proxy creator should be registered yet multiple concrete |
|
|
|
* implementations are available. Therefore this class wraps a simple escalation |
|
|
|
* implementations are available. This class provides a simple escalation protocol, |
|
|
|
* protocol, allowing classes to request a particular auto-proxy creator and know |
|
|
|
* allowing a caller to request a particular auto-proxy creator and know that creator, |
|
|
|
* that class, {@code or a subclass thereof}, will eventually be resident |
|
|
|
* <i>or a more capable variant thereof</i>, will be registered as a post-processor. |
|
|
|
* in the application context. |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
* @author Rob Harrop |
|
|
|
* @author Rob Harrop |
|
|
|
* @author Juergen Hoeller |
|
|
|
* @author Juergen Hoeller |
|
|
|
@ -55,12 +54,10 @@ public abstract class AopConfigUtils { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Stores the auto proxy creator classes in escalation order. |
|
|
|
* Stores the auto proxy creator classes in escalation order. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<>(); |
|
|
|
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<>(3); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Setup the escalation list. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static { |
|
|
|
static { |
|
|
|
|
|
|
|
// Set up the escalation list...
|
|
|
|
APC_PRIORITY_LIST.add(InfrastructureAdvisorAutoProxyCreator.class); |
|
|
|
APC_PRIORITY_LIST.add(InfrastructureAdvisorAutoProxyCreator.class); |
|
|
|
APC_PRIORITY_LIST.add(AspectJAwareAdvisorAutoProxyCreator.class); |
|
|
|
APC_PRIORITY_LIST.add(AspectJAwareAdvisorAutoProxyCreator.class); |
|
|
|
APC_PRIORITY_LIST.add(AnnotationAwareAspectJAutoProxyCreator.class); |
|
|
|
APC_PRIORITY_LIST.add(AnnotationAwareAspectJAutoProxyCreator.class); |
|
|
|
@ -73,8 +70,8 @@ public abstract class AopConfigUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public static BeanDefinition registerAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry, |
|
|
|
public static BeanDefinition registerAutoProxyCreatorIfNecessary( |
|
|
|
@Nullable Object source) { |
|
|
|
BeanDefinitionRegistry registry, @Nullable Object source) { |
|
|
|
|
|
|
|
|
|
|
|
return registerOrEscalateApcAsRequired(InfrastructureAdvisorAutoProxyCreator.class, registry, source); |
|
|
|
return registerOrEscalateApcAsRequired(InfrastructureAdvisorAutoProxyCreator.class, registry, source); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -85,8 +82,8 @@ public abstract class AopConfigUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public static BeanDefinition registerAspectJAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry, |
|
|
|
public static BeanDefinition registerAspectJAutoProxyCreatorIfNecessary( |
|
|
|
@Nullable Object source) { |
|
|
|
BeanDefinitionRegistry registry, @Nullable Object source) { |
|
|
|
|
|
|
|
|
|
|
|
return registerOrEscalateApcAsRequired(AspectJAwareAdvisorAutoProxyCreator.class, registry, source); |
|
|
|
return registerOrEscalateApcAsRequired(AspectJAwareAdvisorAutoProxyCreator.class, registry, source); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -97,8 +94,8 @@ public abstract class AopConfigUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry, |
|
|
|
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary( |
|
|
|
@Nullable Object source) { |
|
|
|
BeanDefinitionRegistry registry, @Nullable Object source) { |
|
|
|
|
|
|
|
|
|
|
|
return registerOrEscalateApcAsRequired(AnnotationAwareAspectJAutoProxyCreator.class, registry, source); |
|
|
|
return registerOrEscalateApcAsRequired(AnnotationAwareAspectJAutoProxyCreator.class, registry, source); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -118,8 +115,8 @@ public abstract class AopConfigUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private static BeanDefinition registerOrEscalateApcAsRequired(Class<?> cls, BeanDefinitionRegistry registry, |
|
|
|
private static BeanDefinition registerOrEscalateApcAsRequired( |
|
|
|
@Nullable Object source) { |
|
|
|
Class<?> cls, BeanDefinitionRegistry registry, @Nullable Object source) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(registry, "BeanDefinitionRegistry must not be null"); |
|
|
|
Assert.notNull(registry, "BeanDefinitionRegistry must not be null"); |
|
|
|
|
|
|
|
|
|
|
|
|