BeanFactory_Runtime
2017-06-09 23:19:33 0 举报
java spring
作者其他创作
大纲/内容
AttributeAccessor
PathMatchingResourcePatternResolver
FactoryBeanRegistrySupport
PropertyEditorRegistry
AliasRegistry
TypeConverter
AbstractBeanDefinitionReader
Loader
Abstract-BeanDefinition
PropertyAccessor
ReaderContext
BeanDefinition-ParserDelegate
String XXX; // 各种bean属性字符串XmlReaderContext;DocumentDefaultsDefinition defaults;ParseState;Environment;Set usedNames;
BeanWrapper
Environment
Configurable-BeanFactory
PropertyOverrideConfigurer
Set beanNames;
BeanFactory
RootBeanDefinition
BeanFactoryPostProcessor
Abstract-BeanFactory
ResourceLoader;PathMatcher pathMatcher = new AntPathMatcher();public PathMatchingResourcePatternResolver() { this.resourceLoader = new DefaultResourceLoader();}public PathMatchingResourcePatternResolver(ResourceLoader ) { this.resourceLoader = resourceLoader;}public PathMatchingResourcePatternResolver(ClassLoader) { this.resourceLoader = new DefaultResourceLoader(classLoader);}
BeanDefinitionReaderUtils
Listable-BeanFactory
AttributeAccessor-Support
注意:这里的示例是将xml信息读取到BeanDefinition,若用代码方式读取,没有下述过程,会更简单。(参看test项目)
BeanDefinition
[void]doRegisterBeanDefinitions(Element root);
Resource
BeanDefinitionParserDelegate
BeanFactory容器启动(初始化)
AutowireCapable-BeanFactory
[int]loadBeanDefinitions(EncodedResource);
Singleton-BeanRegistry
ClassPathResource
String path;ClassLoader;Class clazz;
Abstract-AutowireCapable-BeanFactory
XmlBeanDefinitionReader
BeanNameAware
BeanMetadataElement
Object getSource();
注意:对于BeanFactory,BeanFactoryPostProcessor只能手动在BeanFactory启动后“手动”插入
BeanFactoryAware
DefaultBeanDefinitionDocumentReader
Xml-BeanDefinitionReader
Constants;int validationMode;boolean namespaceAware;DocumentLoader;EntityResolver;NamespaceHandlerResolver;XmlValidationModeDetector;ReaderEventListener;SourceExtractor;ErrorHandler;ProblemReporter;Class documentReaderClass;[DefaultBeanDefinitionDocumentReader.class]ThreadLocalSetresourcesCurrentlyBeingLoaded;
NamespaceHandler
Default-Listable-BeanFactory
Configurable-Listable-BeanFactory
PropertyResourceConfigurer
int order;
DocumentDefaultsDefinition
AbstractFileResolvingResource
PlaceholderConfigurerSupport
placeholderPrefix = \"${\";placeholderSuffix = \"}\";valueSeparator = \":\";boolean ignoreUnresolvablePlaceholders;String beanNameString nullValue;BeanFactory;
BeanFactory只负责定义如何访问“容器管理的Bean”的方法。各个BeanFactory的实现类,负责具体Bean的注册和管理工作。(实现类由于implement了BeanDefinitionRegistry接口所以可以进行注册工作)
SimpleAliasRegistry
Hierarchical-BeanFactory
BeanDefinitionReader
DefaultSingleton-BeanRegistry
PropertiesLoaderSupport
Resource[] locations;Properties[] localProperties;PropertiesPersister;boolean localOverride;String fileEncoding;
ResourceLoader
Resource getResource(String location);ClassLoader getClassLoader();
PropertyValues
Default-ResourceLoader
InputStreamSource
BeanMetadata-AttributeAccessor
PropertyPlaceholderConfigurer
Constants constants;boolean searchSystemEnvironment;
DefauleDocumentLoader
parseBeanDefinitionAttributes(...);parseMetaElements(...);parseConstructorArgElements(...);parsePropertyElements(...);parseQualifierElements(...);
BeanDefinitionDocumentReader
CustomEditorConfigurer
[容器启动阶段]加载配置..分析配置信息..装备到BeanDefinition...其他后处理...
[int]loadBeanDefinitions( Resource... resources);
BeanDefinitionHolder
BeanDefinition;String beanName;String[] aliases;
PropertyResolver
PriorityOrdered
ResourcePatternResolver
Resource[] getResources(String locationPattern);
Abstract-BeanDefinitionReader
BeanDefinitionRegistry;Environment environment;ClassLoader beanClassLoader;ResourceLoader;BeanNameGenerator;[new DefaultBeanNameGenerator()]
BeanWrapperImpl
Aware
BeanDefinitionRegistry
ChildBeanDefinition
XmlReaderContext
XmlBeanDefinitionReader reader;NamespaceHandlerResolver;
EnvironmentCapable
getEnvironment();
Ordered
AbstractResource
Resource;ProblemReporter;ReaderEventListener;SourceExtractor;
DefaultsDefinition
Mutable-PropertyValues
ConfigurablePropertyAccessor
for (root.getChildNodes()) {}
收藏
收藏
0 条评论
下一页