`
wangyun
  • 浏览: 120614 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

PropertyPlaceholderConfigurer

阅读更多
BeanFactoryPostProcessor 接口是对Bean 工厂的后处理操作。


在Spring 的PropertyPlaceholderConfigurer 类是实现BeanFactoryProcessor 接口中非常有用的类。它用于Spring 从外部属性文件中载入属性,并使用这些属性值替换Spring 配置文件中的占位符变量(${varible})。


Spring 的ApplicationContext 容器可以非常方便的使用PropertyPlaceholderConfigurer,只需通过简单的配置即可使用。

示例:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="jdbc.properties" />
</bean>

如果需要使用多个配置文件可以使用PropertyPlaceholderConfigurer 的locations属性。


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics