根据配置的拦截器创建一个代理
/**
* Create a proxy with the configured interceptors if the bean is
* identified as one to proxy by the subclass.
* @see #getAdvicesAndAdvisorsForBean
*/
@Override
public Object postProcessAfterInitialization(@Nullable Object bean, String beanName) {
if (bean != null) {
Object cacheKey = getCacheKey(bean.getClass(), beanName);
if (this.earlyProxyReferences.remove(cacheKey) != bean) {
//创建代理对象
return wrapIfNecessary(bean, beanName, cacheKey);
}
}
return bean;
}
分析:
创建代理对象
wrapIfNecessary(bean, beanName, cacheKey);