Spring源码学习
Spring AOP @EnableAspectJAutoProxy
使用Spring的AOP示例代码
切面类LogAspects
//切面注解
@Aspect
public class LogAspects {
@Pointcut("execution(public int com.enjoy.cap10.aop.Calculator.*(..))")
public void pointCut() {
}
/**
* @Befor 代表在目标方法执行前切入,并制定在哪个方法前切入
*/
@Before(value = "pointCut()", argNames = "joinPoint")
public void logStart(JoinPoint joinPoint) {
System.out.println(joinPoint.getSignature().getName()+"除法运行。。。参数列表是:{"+ Arrays.asList(joinPoint.getArgs())+"}");
}
/**
* @After
*/
@After(value = "pointCut()", argNames = "joinPoint")
public void logEnd(JoinPoint joinPoint) {
System.out.println(joinPoint.getSignature().getName()+"除法结束。。。。。");
}
@AfterReturning(value = "pointCut()", returning = "result")
public void logReturn(Object result) {
System.out.println("除法正常返回。。。。。运行结果是:{"+result+"}");
}
@AfterThrowing(value = "pointCut()", throwing = "e")
public void logException(Exception e) {
System.out.println("除法运行异常。。。。。异常信息是:{"+ e+"}" );
}
}
从开启AOP功能的注解@EnableAspectJAutoProxy
入手来学习Spring源码
配置类Cap10MainConfig
@Configuration
//开启AOP
@EnableAspectJAutoProxy
public class Cap10MainConfig {
@Bean
public Calculator calculator() {
return new Calculator();
}
@Bean
public LogAspects logAspects() {
return new LogAspects();
}
}
进入@EnableAspectJAutoProxy
@Import(AspectJAutoProxyRegistrar.class)
public @interface EnableAspectJAutoProxy {
//proxyTargetClass属性,默认false,采用JDK动态代理织入增强(实现接口的方式);如果设为true,则采用CGLIB动态代理织入增强
boolean proxyTargetClass() default false;
//通过aop框架暴露该代理对象,aopContext能够访问
boolean exposeProxy() default false;
}
ImportBeanDefinitionRegistrar接口作用: 能给容器中自定义注册组件。
进入@EnableAspectJAutoProxy
注解注入的AspectJAutoProxyRegistrar
类
class AspectJAutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
/**
* Register, escalate, and configure the AspectJ auto proxy creator based on the value
* of the @{@link EnableAspectJAutoProxy#proxyTargetClass()} attribute on the importing
* {@code @Configuration} class.
*/
@Override
public void registerBeanDefinitions(
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
//如果有需要的话注册组件
AopConfigUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary(registry);
AnnotationAttributes enableAspectJAutoProxy =
AnnotationConfigUtils.attributesFor(importingClassMetadata, EnableAspectJAutoProxy.class);
if (enableAspectJAutoProxy != null) {
if (enableAspectJAutoProxy.getBoolean("proxyTargetClass")) {
AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry);
}
if (enableAspectJAutoProxy.getBoolean("exposeProxy")) {
AopConfigUtils.forceAutoProxyCreatorToExposeProxy(registry);
}
}
}
}
在AspectJAutoProxyRegistrar里可以自定义注册一些bean
进入AopConfigUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary(registry);
方法
@Nullable
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry) {
return registerAspectJAnnotationAutoProxyCreatorIfNecessary(registry, null);
}
@Nullable
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry,
@Nullable Object source) {
//注册的Bean就是AnnotationAwareAspectJAutoProxyCreator
return registerOrEscalateApcAsRequired(AnnotationAwareAspectJAutoProxyCreator.class, registry, source);
}
@Nullable
private static BeanDefinition registerOrEscalateApcAsRequired(Class<?> cls, BeanDefinitionRegistry registry,
@Nullable Object source) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
//判断是否存在这个Bean,如果存在则执行处理;第一次不存在
if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) {
BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
if (!cls.getName().equals(apcDefinition.getBeanClassName())) {
int currentPriority = findPriorityForClass(apcDefinition.getBeanClassName());
int requiredPriority = findPriorityForClass(cls);
if (currentPriority < requiredPriority) {
apcDefinition.setBeanClassName(cls.getName());
}
}
return null;
}
//组装bean,cls就是上面的AnnotationAwareAspectJAutoProxyCreator
RootBeanDefinition beanDefinition = new RootBeanDefinition(cls);
beanDefinition.setSource(source);
beanDefinition.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
//public static final String AUTO_PROXY_CREATOR_BEAN_NAME = "org.springframework.aop.config.internalAutoProxyCreator";
// 注册的Bean的name为internalAutoProxyCreator,类型为AnnotationAwareAspectJAutoProxyCreator
registry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);
return beanDefinition;
}
AnnotationAwareAspectJAutoProxyCreator
类的继承关系如图:
AnnotationAwareAspectJAutoProxyCreator-->
AspectJAwareAdvisorAutoProxyCreator-->
AbstractAdvisorAutoProxyCreator-->
AbstractAutoProxyCreator-->
ProxyProcessorSupport
SmartInstantiationAwareBeanPostProcessor
BeanFactoryAware
SmartInstantiationAwareBeanPostProcessor
:bean的后置处理器
BeanFactoryAware
:能把beanFacotry bean工厂传进来
1、分析创建和注册AnnotationAwareAspectJAutoProxyCreator的流程
从测试类中的创建容器开始
测试类Cap10Test
代码如下:
public class Cap10Test {
@Test
public void test() throws Exception {
AnnotationConfigApplicationContext app = new AnnotationConfigApplicationContext(Cap10MainConfig.class);
Calculator calculator = app.getBean(Calculator.class);
int result = calculator.div(5, 1);
System.out.println(result);
app.close();
}
}
进入AnnotationConfigApplicationContext
类查看构造方法AnnotationConfigApplicationContext(Class<?>... annotatedClasses)
/**
* Create a new AnnotationConfigApplicationContext, deriving bean definitions
* from the given annotated classes and automatically refreshing the context.
* @param annotatedClasses one or more annotated classes,
* e.g. {@link Configuration @Configuration} classes
*/
public AnnotationConfigApplicationContext(Class<?>... annotatedClasses) {
this();
register(annotatedClasses);
refresh();
}
- 1)、register()传入配置类,准备创建ioc容器;
- 2)、注册配置类,调用refresh()刷新创建容器;
进入AbstractApplicationContext
类查看refresh()
方法
@Override
public void refresh() throws BeansException, IllegalStateException {
synchronized (this.startupShutdownMonitor) {
// Prepare this context for refreshing.
prepareRefresh();
// Tell the subclass to refresh the internal bean factory.
ConfigurableListableBeanFactory beanFactory = obtainFreshBeanFactory();
// Prepare the bean factory for use in this context.
prepareBeanFactory(beanFactory);
try {
...
// Register bean processors that intercept bean creation.
registerBeanPostProcessors(beanFactory);
...
// Instantiate all remaining (non-lazy-init) singletons.
finishBeanFactoryInitialization(beanFactory);
// Last step: publish corresponding event.
finishRefresh();
}
...
}
}
- 3)、registerBeanPostProcessors(beanFactory);注册bean的后置处理器来方便拦截bean的创建(主要是分析创建AnnotationAwareAspectJAutoProxyCreator);
创建internalAutoProxyCreator的BeanPostProcessor【其实就是AnnotationAwareAspectJAutoProxyCreator】
进入AbstractApplicationContext
类的registerBeanPostProcessors()
方法
protected void registerBeanPostProcessors(ConfigurableListableBeanFactory beanFactory) {
PostProcessorRegistrationDelegate.registerBeanPostProcessors(beanFactory, this);
}
进入PostProcessorRegistrationDelegate
类的registerBeanPostProcessors
方法
public static void registerBeanPostProcessors(
ConfigurableListableBeanFactory beanFactory, AbstractApplicationContext applicationContext) {
//先获取ioc容器已经定义了的需要创建对象的所有BeanPostProcessor
String[] postProcessorNames = beanFactory.getBeanNamesForType(BeanPostProcessor.class, true, false);
// Register BeanPostProcessorChecker that logs an info message when
// a bean is created during BeanPostProcessor instantiation, i.e. when
// a bean is not eligible for getting processed by all BeanPostProcessors.
int beanProcessorTargetCount = beanFactory.getBeanPostProcessorCount() + 1 + postProcessorNames.length;
//给容器中加别的BeanPostProcessor
beanFactory.addBeanPostProcessor(new BeanPostProcessorChecker(beanFactory, beanProcessorTargetCount));
// Separate between BeanPostProcessors that implement PriorityOrdered,
// Ordered, and the rest.
List<BeanPostProcessor> priorityOrderedPostProcessors = new ArrayList<>();
List<BeanPostProcessor> internalPostProcessors = new ArrayList<>();
List<String> orderedPostProcessorNames = new ArrayList<>();
List<String> nonOrderedPostProcessorNames = new ArrayList<>();
for (String ppName : postProcessorNames) {
//优先注册实现了PriorityOrdered接口的BeanPostProcessor;
if (beanFactory.isTypeMatch(ppName, PriorityOrdered.class)) {
BeanPostProcessor pp = beanFactory.getBean(ppName, BeanPostProcessor.class);
priorityOrderedPostProcessors.add(pp);
if (pp instanceof MergedBeanDefinitionPostProcessor) {
internalPostProcessors.add(pp);
}
}
//再给容器中注册实现了Ordered接口的BeanPostProcessor;
else if (beanFactory.isTypeMatch(ppName, Ordered.class)) {
orderedPostProcessorNames.add(ppName);
}
//注册没实现优先级接口的BeanPostProcessor;
else {
nonOrderedPostProcessorNames.add(ppName);
}
}
// First, register the BeanPostProcessors that implement PriorityOrdered.
sortPostProcessors(priorityOrderedPostProcessors, beanFactory);
registerBeanPostProcessors(beanFactory, priorityOrderedPostProcessors);
// Next, register the BeanPostProcessors that implement Ordered.
List<BeanPostProcessor> orderedPostProcessors = new ArrayList<>();
for (String ppName : orderedPostProcessorNames) {
BeanPostProcessor pp = beanFactory.getBean(ppName, BeanPostProcessor.class);
orderedPostProcessors.add(pp);
if (pp instanceof MergedBeanDefinitionPostProcessor) {
internalPostProcessors.add(pp);
}
}
sortPostProcessors(orderedPostProcessors, beanFactory);
registerBeanPostProcessors(beanFactory, orderedPostProcessors);
// Now, register all regular BeanPostProcessors.
List<BeanPostProcessor> nonOrderedPostProcessors = new ArrayList<>();
for (String ppName : nonOrderedPostProcessorNames) {
BeanPostProcessor pp = beanFactory.getBean(ppName, BeanPostProcessor.class);
nonOrderedPostProcessors.add(pp);
if (pp instanceof MergedBeanDefinitionPostProcessor) {
internalPostProcessors.add(pp);
}
}
registerBeanPostProcessors(beanFactory, nonOrderedPostProcessors);
// Finally, re-register all internal BeanPostProcessors.
sortPostProcessors(internalPostProcessors, beanFactory);
registerBeanPostProcessors(beanFactory, internalPostProcessors);
// Re-register post-processor for detecting inner beans as ApplicationListeners,
// moving it to the end of the processor chain (for picking up proxies etc).
beanFactory.addBeanPostProcessor(new ApplicationListenerDetector(applicationContext));
}
private static void registerBeanPostProcessors(
ConfigurableListableBeanFactory beanFactory, List<BeanPostProcessor> postProcessors) {
//注册BeanPostProcessor,实际上就是创建BeanPostProcessor对象,保存在容器中;
for (BeanPostProcessor postProcessor : postProcessors) {
beanFactory.addBeanPostProcessor(postProcessor);
}
}
创建Bean的流程如下:
进入AbstractApplicationContext
类中的finishBeanFactoryInitialization(beanFactory)
方法
protected void finishBeanFactoryInitialization(ConfigurableListableBeanFactory beanFactory) {
// Initialize conversion service for this context.
if (beanFactory.containsBean(CONVERSION_SERVICE_BEAN_NAME) &&
beanFactory.isTypeMatch(CONVERSION_SERVICE_BEAN_NAME, ConversionService.class)) {
beanFactory.setConversionService(
beanFactory.getBean(CONVERSION_SERVICE_BEAN_NAME, ConversionService.class));
}
// Register a default embedded value resolver if no bean post-processor
// (such as a PropertyPlaceholderConfigurer bean) registered any before:
// at this point, primarily for resolution in annotation attribute values.
if (!beanFactory.hasEmbeddedValueResolver()) {
beanFactory.addEmbeddedValueResolver(strVal -> getEnvironment().resolvePlaceholders(strVal));
}
// Initialize LoadTimeWeaverAware beans early to allow for registering their transformers early.
String[] weaverAwareNames = beanFactory.getBeanNamesForType(LoadTimeWeaverAware.class, false, false);
for (String weaverAwareName : weaverAwareNames) {
getBean(weaverAwareName);
}
// Stop using the temporary ClassLoader for type matching.
beanFactory.setTempClassLoader(null);
// Allow for caching all bean definition metadata, not expecting further changes.
beanFactory.freezeConfiguration();
// Instantiate all remaining (non-lazy-init) singletons.
beanFactory.preInstantiateSingletons();
}
beanFactory.preInstantiateSingletons()方法实例化所有剩余的非懒加载的单例bean,进入DefaultListableBeanFactory
类的preInstantiateSingletons
方法;
@Override
public void preInstantiateSingletons() throws BeansException {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Pre-instantiating singletons in " + this);
}
// Iterate over a copy to allow for init methods which in turn register new bean definitions.
// While this may not be part of the regular factory bootstrap, it does otherwise work fine.
//获取容器中所有的bean
List<String> beanNames = new ArrayList<>(this.beanDefinitionNames);
// Trigger initialization of all non-lazy singleton beans...
//循环依次创建
for (String beanName : beanNames) {
RootBeanDefinition bd = getMergedLocalBeanDefinition(beanName);
//单例,非懒加载
if (!bd.isAbstract() && bd.isSingleton() && !bd.isLazyInit()) {
//是否是以&开头的工厂Bean
if (isFactoryBean(beanName)) {
Object bean = getBean(FACTORY_BEAN_PREFIX + beanName);
if (bean instanceof FactoryBean) {
final FactoryBean<?> factory = (FactoryBean<?>) bean;
boolean isEagerInit;
if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) {
isEagerInit = AccessController.doPrivileged((PrivilegedAction<Boolean>)
((SmartFactoryBean<?>) factory)::isEagerInit,
getAccessControlContext());
}
else {
isEagerInit = (factory instanceof SmartFactoryBean &&
((SmartFactoryBean<?>) factory).isEagerInit());
}
if (isEagerInit) {
getBean(beanName);
}
}
}
else {
//进入创建Bean
getBean(beanName);
}
}
}
// Trigger post-initialization callback for all applicable beans...
for (String beanName : beanNames) {
Object singletonInstance = getSingleton(beanName);
if (singletonInstance instanceof SmartInitializingSingleton) {
final SmartInitializingSingleton smartSingleton = (SmartInitializingSingleton) singletonInstance;
if (System.getSecurityManager() != null) {
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
smartSingleton.afterSingletonsInstantiated();
return null;
}, getAccessControlContext());
}
else {
smartSingleton.afterSingletonsInstantiated();
}
}
}
}
获取容器中的所有Bean,循环进行创建,非工厂Bean,则进入AbstractBeanFactory
类中的getBean(beanName)
方法
@Override
public Object getBean(String name) throws BeansException {
return doGetBean(name, null, null, false);
}
protected <T> T doGetBean(final String name, @Nullable final Class<T> requiredType,
@Nullable final Object[] args, boolean typeCheckOnly) throws BeansException {
//获取Bean name
final String beanName = transformedBeanName(name);
Object bean;
// Eagerly check singleton cache for manually registered singletons.
//第一次获取单例Bean为空
Object sharedInstance = getSingleton(beanName);
if (sharedInstance != null && args == null) {
if (logger.isDebugEnabled()) {
if (isSingletonCurrentlyInCreation(beanName)) {
logger.debug("Returning eagerly cached instance of singleton bean '" + beanName +
"' that is not fully initialized yet - a consequence of a circular reference");
}
else {
logger.debug("Returning cached instance of singleton bean '" + beanName + "'");
}
}
bean = getObjectForBeanInstance(sharedInstance, name, beanName, null);
}
else {
...
if (!typeCheckOnly) {
//标记为已创建
markBeanAsCreated(beanName);
}
try {
...
// Create bean instance.
if (mbd.isSingleton()) {
sharedInstance = getSingleton(beanName, () -> {
try {
//创建单例Bean
return createBean(beanName, mbd, args);
}
catch (BeansException ex) {
// Explicitly remove instance from singleton cache: It might have been put there
// eagerly by the creation process, to allow for circular reference resolution.
// Also remove any beans that received a temporary reference to the bean.
destroySingleton(beanName);
throw ex;
}
});
bean = getObjectForBeanInstance(sharedInstance, name, beanName, mbd);
}
...
return (T) bean;
}
进入创建单例Bean的AbstractAutowireCapableBeanFactory
类中的createBean(beanName, mbd, args)
方法
protected Object createBean(String beanName, RootBeanDefinition mbd, @Nullable Object[] args)
throws BeanCreationException {
...
try {
Object beanInstance = doCreateBean(beanName, mbdToUse, args);
if (logger.isDebugEnabled()) {
logger.debug("Finished creating instance of bean '" + beanName + "'");
}
return beanInstance;
}
...
}
进入AbstractAutowireCapableBeanFactory
类的doCreateBean(beanName, mbdToUse, args)
方法
protected Object doCreateBean(final String beanName, final RootBeanDefinition mbd, final @Nullable Object[] args)
throws BeanCreationException {
// Instantiate the bean.
BeanWrapper instanceWrapper = null;
if (mbd.isSingleton()) {
instanceWrapper = this.factoryBeanInstanceCache.remove(beanName);
}
if (instanceWrapper == null) {
//创建Bean实例
instanceWrapper = createBeanInstance(beanName, mbd, args);
}
...
// Initialize the bean instance.
Object exposedObject = bean;
try {
//给Bean的各种属性赋值
populateBean(beanName, mbd, instanceWrapper);
//初始化Bean
exposedObject = initializeBean(beanName, exposedObject, mbd);
}
catch (Throwable ex) {
if (ex instanceof BeanCreationException && beanName.equals(((BeanCreationException) ex).getBeanName())) {
throw (BeanCreationException) ex;
}
else {
throw new BeanCreationException(
mbd.getResourceDescription(), beanName, "Initialization of bean failed", ex);
}
}
...
return exposedObject;
}
进入initializeBean
方法
protected Object initializeBean(final String beanName, final Object bean, @Nullable RootBeanDefinition mbd) {
if (System.getSecurityManager() != null) {
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
invokeAwareMethods(beanName, bean);
return null;
}, getAccessControlContext());
}
else {
//处理Aware接口的方法回调
invokeAwareMethods(beanName, bean);
}
Object wrappedBean = bean;
if (mbd == null || !mbd.isSynthetic()) {
//执行后置处理器的PostProcessorsBeforeInitialization()
wrappedBean = applyBeanPostProcessorsBeforeInitialization(wrappedBean, beanName);
}
try {
//执行自定义的Bean初始化方法init-method
invokeInitMethods(beanName, wrappedBean, mbd);
}
catch (Throwable ex) {
throw new BeanCreationException(
(mbd != null ? mbd.getResourceDescription() : null),
beanName, "Invocation of init method failed", ex);
}
if (mbd == null || !mbd.isSynthetic()) {
//执行后置处理器的PostProcessorsAfterInitialization()
wrappedBean = applyBeanPostProcessorsAfterInitialization(wrappedBean, beanName);
}
return wrappedBean;
}
2、如何创建增强的Caculator增强bean的流程
Bean创建及初始化流程
graph TD
AnnotationConfigApplicationContext-->|刷新容器|refresh;
refresh-->registerBeanPostProcessors;
refresh-->|创建剩下的非懒加载单实例bean|finishBeanFactoryInitialization;
finishBeanFactoryInitialization-->preInstantiateSingletons;
preInstantiateSingletons-->getBean;
getBean-->doGetBean;
doGetBean-->createBean;
createBean-->resolveBeforeInstantiation;
resolveBeforeInstantiation-->|hasInstantiationAwareBeanPostProcessors|applyBeanPostProcessorsBeforeInstantiation;
applyBeanPostProcessorsBeforeInstantiation-->|InstantiationAwareBeanPostProcessor|postProcessBeforeInstantiation;
postProcessBeforeInstantiation-->|targetSource|createProxy;
createBean-->doCreateBean;
doCreateBean-->createBeanInstance;
doCreateBean-->populateBean;
doCreateBean-->initializeBean;
initializeBean-->invokeAwareMethods;
initializeBean-->applyBeanPostProcessorsBeforeInitialization;
initializeBean-->invokeInitMethods;
initializeBean-->applyBeanPostProcessorsAfterInitialization;
applyBeanPostProcessorsAfterInitialization-->postProcessAfterInitialization;
postProcessAfterInitialization-->wrapIfNecessary;
wrapIfNecessary-->getAdvicesAndAdvisorsForBean;
getAdvicesAndAdvisorsForBean-->createProxy;
createProxy-->getProxy;
getProxy-->cglib;
getProxy-->jdk;
registerBeanPostProcessors-->PostProcessorRegistrationDelegate.registerBeanPostProcessors;
PostProcessorRegistrationDelegate.registerBeanPostProcessors-->|BeanPostProcessor|beanFactory.getBeanNamesForType;
beanFactory.getBeanNamesForType-->PriorityOrdered;
beanFactory.getBeanNamesForType-->Ordered;
beanFactory.getBeanNamesForType-->others;
PriorityOrdered-->private.registerBeanPostProcessors;
Ordered-->private.registerBeanPostProcessors;
others-->private.registerBeanPostProcessors;
private.registerBeanPostProcessors-->beanFactory.addBeanPostProcessor;
graph TD
EnableAspectJAutoProxy-->|默认为false时JDK动态代,true用CGLIB动态代理|proxyTargetClass;
EnableAspectJAutoProxy-->|通过aop框架暴露该代理对象,aopContext能够访问|exposeProxy;
EnableAspectJAutoProxy-->AspectJAutoProxyRegistrar;
AspectJAutoProxyRegistrar-->|容器中自定义组件|ImportBeanDefinitionRegistrar;
ImportBeanDefinitionRegistrar-->registerBeanDefinitions;
AspectJAutoProxyRegistrar-->registerAspectJAnnotationAutoProxyCreatorIfNecessary;
registerAspectJAnnotationAutoProxyCreatorIfNecessary-->registerOrEscalateApcAsRequired;
registerOrEscalateApcAsRequired-->registerBeanDefinition;
registerBeanDefinition-->|BeanName|org.springframework.aop.config.internalAutoProxyCreator;
registerBeanDefinition-->|Class|AnnotationAwareAspectJAutoProxyCreator;
AnnotationAwareAspectJAutoProxyCreator类的关系图如下
graph BT
AnnotationAwareAspectJAutoProxyCreator-->AspectJAwareAdvisorAutoProxyCreator;
AspectJAwareAdvisorAutoProxyCreator-->AbstractAdvisorAutoProxyCreator;
AbstractAdvisorAutoProxyCreator-->AbstractAutoProxyCreator;
AbstractAutoProxyCreator-->ProxyProcessorSupport;
AbstractAutoProxyCreator-->SmartInstantiationAwareBeanPostProcessor;
AbstractAutoProxyCreator-->BeanFactoryAware;
SmartInstantiationAwareBeanPostProcessor-->InstantiationAwareBeanPostProcessor;
InstantiationAwareBeanPostProcessor-->BeanPostProcessor;
ProxyProcessorSupport-->ProxyConfig;
ProxyProcessorSupport-->Ordered;
ProxyProcessorSupport-->BeanClassLoaderAware;
ProxyProcessorSupport-->AopInfrastructureBean;
BeanClassLoaderAware-->Aware;
BeanFactoryAware-->Aware;