PropertyPlaceholderConfigurer属性配置文件 资源文件绑定
2012-03-19 10:34
411 查看
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:jdbc.properties</value> <value>classpath:db.properties</value> </list> </property> </bean>
或
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:jdbc.properties</value> </property> </bean>
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer源码为
/** * Set a location of a properties file to be loaded. * <p>Can point to a classic properties file or to an XML file * that follows JDK 1.5's properties XML format. */ public void setLocation(Resource location) { this.locations = new Resource[] {location}; } /** * Set locations of properties files to be loaded. * <p>Can point to classic properties files or to XML files * that follow JDK 1.5's properties XML format. * <p>Note: Properties defined in later files will override * properties defined earlier files, in case of overlapping keys. * Hence, make sure that the most specific files are the last * ones in the given list of locations. */ public void setLocations(Resource[] locations) { this.locations = locations; }
相关文章推荐
- Spring环境搭建之:通过PropertyPlaceholderConfigurer加载属性配置文件:
- spring管理属性配置文件properties——使用PropertyPlaceholderConfigurer
- spring管理属性配置文件properties——PropertiesFactoryBean和PropertyPlaceholderConfigurer的区别
- 【转】spring管理属性配置文件properties——使用PropertiesFactoryBean|spring管理属性配置文件properties——使用PropertyPlaceholderConfigurer
- Spring代码实例系列-09:通过Spring PropertyPlaceholderConfigurer将properties配置的属性注入到xml配置文件中
- PropertyPlaceholderConfigurer加载属性配置文件:
- Spring学习笔记 通过PropertyPlaceholderConfigurer来使用properties文件初始化Map类型属性
- Spring配置文件中使用PropertyPlaceholderConfigurer配置获取jdbc的配置信息
- 使用PropertyPlaceholderConfigurer读取配置文件
- 继承PropertyPlaceholderConfigurer 实现动态加载配置文件
- Spring中扩展 PropertyPlaceholderConfigurer处理加密属性文件
- springMVC用property-placeholder加载配置属性文件
- Spring PropertyPlaceholderConfigurer解析Java Properties属性文件值
- spring context:property-placeholder无法加载配置文件,导致属性无效
- spring 配置文件 获取变量(PropertyPlaceholderConfigurer)
- spring里PropertyPlaceholderConfigurer读取属性文件
- Spring中扩展 PropertyPlaceholderConfigurer处理加密属性文件
- Spring属性文件的覆盖配置:uses of PropertyOverrideConfigurer
- spring中的PropertyPlaceholderConfigurer访问properties文件配置
- spring PropertyPlaceholderConfigurer 找不到配置文件原因