/*
* Copyright 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.support;
import java.beans.PropertyEditor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;
import org.springframework.beans.TypeConverter;
import org.springframework.beans.TypeMismatchException;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanCurrentlyInCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.BeanIsAbstractException;
import org.springframework.beans.factory.BeanIsNotAFactoryException;
import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
import org.springframework.beans.factory.CannotLoadBeanClassException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.FactoryBeanNotInitializedException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
import org.springframework.beans.factory.config.Scope;
import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
import org.springframework.core.CollectionFactory;
import org.springframework.core.MethodParameter;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
/**
* Abstract superclass for BeanFactory implementations, implementing the
* ConfigurableBeanFactory SPI interface. Does <i>not</i> assume a listable
* bean factory: can therefore also be used as base class for bean factory
* implementations which fetch bean definitions from a variety of backend
* resources (where bean definition access is an expensive operation).
*
* <p>This class provides singleton/prototype determination, singleton cache,
* aliases, FactoryBean handling, bean definition merging for child bean definitions,
* and bean destruction (DisposableBean interface, custom destroy methods).
* Furthermore, it can manage a bean factory hierarchy, through implementing the
* HierarchicalBeanFactory interface (superinterface of ConfigurableBeanFactory).
*
* <p>The main template methods to be implemented by subclasses are
* <code>getBeanDefinition</code> and <code>createBean</code>, retrieving a
* bean definition for a given bean name or creating a bean instance for a
* given bean definition. Default implementations for those can be found in
* DefaultListableBeanFactory or AbstractAutowireCapableBeanFactory, respectively.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @since 15 April 2001
* @see #getBeanDefinition
* @see #createBean
* @see org.springframework.beans.factory.HierarchicalBeanFactory
* @see org.springframework.beans.factory.DisposableBean
* @see RootBeanDefinition
* @see ChildBeanDefinition
* @see AbstractAutowireCapableBeanFactory#createBean
* @see DefaultListableBeanFactory#getBeanDefinition
*/
public abstract class AbstractBeanFactory extends DefaultSingletonBeanRegistry implements ConfigurableBeanFactory {
/** Parent bean factory, for bean inheritance support */
private BeanFactory parentBeanFactory;
/** ClassLoader to resolve bean class names with, if necessary */
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
/** Whether to cache bean metadata or rather reobtain it for every access */
private boolean cacheBeanMetadata = true;
/** Custom PropertyEditors to apply to the beans of this factory */
private final Map customEditors = new HashMap();
/** Custom PropertyEditorRegistrars to apply to the beans of this factory */
private final Set propertyEditorRegistrars = CollectionFactory.createLinkedSetIfPossible(16);
/** BeanPostProcessors to apply in createBean */
private final List beanPostProcessors = new ArrayList();
/** Indicates whether any DestructionAwareBeanPostProcessors have been registered */
private boolean hasDestructionAwareBeanPostProcessors;
/** Map from scope identifier String to corresponding Scope */
private final Map scopes = new HashMap();
/** Map from alias to canonical bean name */
private final Map aliasMap = new HashMap();
/** Map from bean name to merged RootBeanDefinition */
private final Map mergedBeanDefinitions = new HashMap();
/** Names of beans that have already been created at least once */
private final Set alreadyCreated = Collections.synchronizedSet(new HashSet());
/** Names of beans that are currently in creation */
private final ThreadLocal prototypesCurrentlyInCreation = new ThreadLocal();
/** Cache of singleton objects created by FactoryBeans: FactoryBean name --> object */
private final Map factoryBeanObjectCache = new HashMap();
/**
* Create a new AbstractBeanFactory.
*/
public AbstractBeanFactory() {
}
/**
* Create a new AbstractBeanFactory with the given parent.
* @param parentBeanFactory parent bean factory, or <code>null</code> if none
* @see #getBean
*/
public AbstractBeanFactory(BeanFactory parentBeanFactory) {
this.parentBeanFactory = parentBeanFactory;
}
//---------------------------------------------------------------------
// Implementation of BeanFactory interface
//---------------------------------------------------------------------
public Object getBean(String name) throws BeansException {
return getBean(name, null, null);
}
public Object getBean(String name, Class requiredType) throws BeansException {
return getBean(name, requiredType, null);
}
/**
* Return the bean with the given name,
* checking the parent bean factory if not found.
* @param name the name of the bean to retrieve
* @param args arguments to use if creating a prototype using explicit arguments to a
* static factory method. It is invalid to use a non-null args value in any other case.
*/
public Object getBean(String name, Object[] args) throws BeansException {
return getBean(name, null, args);
}
/**
* Return the bean with the given name,
* checking the parent bean factory if not found.
* @param name the name of the bean to retrieve
* @param requiredType the required type of the bean to retrieve
* @param args arguments to use if creating a prototype using explicit arguments to a
* static factory method. It is invalid to use a non-null args value in any other case.
*/
public Object getBean(String name, C
没有合适的资源?快使用搜索试试~ 我知道了~
Spring 2.0 源代码
共1681个文件
java:1492个
html:166个
xsd:7个
需积分: 9 5 下载量 174 浏览量
2008-07-23
10:51:01
上传
评论
收藏 2.69MB RAR 举报
温馨提示
Spring 2.0 源代码
资源推荐
资源详情
资源评论
收起资源包目录
Spring 2.0 源代码 (1681个子文件)
spring-beans-2.0.dtd 23KB
spring-beans.dtd 21KB
spring.ftl 11KB
spring.handlers 609B
package.html 2KB
package.html 2KB
package.html 1KB
package.html 1KB
package.html 1KB
package.html 1KB
package.html 1KB
package.html 1KB
package.html 1KB
package.html 891B
package.html 824B
package.html 792B
package.html 753B
package.html 636B
package.html 635B
package.html 626B
package.html 606B
package.html 597B
package.html 592B
package.html 560B
package.html 555B
package.html 538B
package.html 537B
package.html 521B
package.html 478B
package.html 462B
package.html 461B
package.html 458B
package.html 427B
package.html 425B
package.html 417B
package.html 354B
package.html 348B
package.html 341B
package.html 335B
package.html 325B
package.html 317B
package.html 302B
package.html 298B
package.html 298B
package.html 290B
package.html 266B
package.html 265B
package.html 264B
package.html 253B
package.html 247B
package.html 246B
package.html 245B
package.html 242B
package.html 240B
package.html 237B
package.html 234B
package.html 234B
package.html 233B
package.html 226B
package.html 225B
package.html 224B
package.html 222B
package.html 221B
package.html 220B
package.html 218B
package.html 218B
package.html 214B
package.html 213B
package.html 206B
package.html 204B
package.html 203B
package.html 198B
package.html 196B
package.html 195B
package.html 192B
package.html 191B
package.html 190B
package.html 190B
package.html 189B
package.html 189B
package.html 188B
package.html 185B
package.html 184B
package.html 178B
package.html 178B
package.html 177B
package.html 176B
package.html 176B
package.html 176B
package.html 176B
package.html 175B
package.html 175B
package.html 174B
package.html 174B
package.html 173B
package.html 170B
package.html 169B
package.html 168B
package.html 168B
package.html 168B
共 1681 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
magic_programer
- 粉丝: 3
- 资源: 34
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- SSCMS登录模块需要的JS文件
- JSP网络购物中心毕业设计(源代码+论文).rar
- 白盒测试报告.docx
- 基于LM5117芯片评估开发板硬件参考设计(原理图+PCB)+中英文数据手册资料.zip
- 照片批量重命名软件(文件批量修改图片文件名)
- app.apk
- 人工智能(AI)是计算机科学的一个分支,旨在开发和应用能够模拟、延伸和扩展人类智能的理论、方法和技术,包括机器人、语言识别、图像
- 嵌入式与物联网开发是当今信息技术领域的两大重要分支,它们相互交织,共同推动着智能化时代的进步 嵌入式开发主要关注在嵌入式操作
- 网络安全,这一看似高深莫测的领域,实则与我们每个人的生活息息相关
- 毕业设计基于深度学习的视觉问答系统源码+文档说明+答辩PPT.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功