spring源碼10——AbstractAutoProxyCreator.postProcessAfterInitialization

根據配置的攔截器創建一個代理

/**
 * 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);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章