美文网首页spring
property-placeholder原理解析

property-placeholder原理解析

作者: 冰点猎手 | 来源:发表于2017-03-28 20:17 被阅读0次

spring的配置项 <context:property-placeholder location="classpath:xxx.properties">,在location配置了属性文件,spring会为我们建立一个bean PropertyPlaceholderConfigurer,这个bean是实现了BeanFactoryPostProcessor这个接口,这个BeanFactoryPostProcessor会遍历容器中所有的bean 定义,并处理定义中的属性值、class name、方法名等等:

visitParentName(beanDefinition);

visitBeanClassName(beanDefinition);

visitFactoryBeanName(beanDefinition);

visitFactoryMethodName(beanDefinition);

visitScope(beanDefinition);

visitPropertyValues(beanDefinition.getPropertyValues());

ConstructorArgumentValues cas = beanDefinition.getConstructorArgumentValues();

visitIndexedArgumentValues(cas.getIndexedArgumentValues());

visitGenericArgumentValues(cas.getGenericArgumentValues());

相关文章

网友评论

    本文标题:property-placeholder原理解析

    本文链接:https://www.haomeiwen.com/subject/mkrsottx.html