applicationContext.xml读取properties中属性
来源:互联网 发布:取色软件 编辑:程序博客网 时间:2024/06/05 10:52
项目有需要,所以查了些资料,在这里作为记录
参考地址:http://fionajw.iteye.com/blog/674981
载入方式一:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> <context:property-placeholder location="classpath:uc.properties"/></beans>
载入方式二:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> <bean id="configBean" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>uc.properties</value> </property> </bean></beans>
使用方式:
<value>${name}</value>
如果有多个properties文件的情况
<bean id="configBean" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"><list> <value>hello.properties</value> <value>welcome.properties</value> <value>other.properties</value> </list> </property></bean>
- applicationContext.xml读取properties中属性
- applicationContext.xml读取properties中属性(转的,方便自己记忆)
- applicationContext.xml中设置读取jdbc.properties文件
- applicationContext.xml中设置读取jdbc.properties文件
- ApplicationContext.xml中加载properties配置文件
- 用Properties类读取xml和.properties中的属性
- 在applicationContext.xml中引入jdbc.properties文件
- spring:ClassPathResource读取applicationContext.xml,如果加属性编辑器失败
- 从properties文件中读取属性
- spring中属性文件properties的读取
- 如何读取properties文件中属性
- Java中读取配置文件(properties、xml)
- 用java.util.Properties类读取属性文件的内容,或者把属性写到xml文件中
- Mybatis Configuration.xml中properties属性定义
- spring的xml配置文件读取properties文件中的属性
- applicationContext.xml配置文件的读取
- 读取applicationContext.xml报错
- 读取属性文件*.properties
- webservice生成
- C++ string大小写转换
- 【Android游戏开发二十三】自定义ListView【通用】适配器并实现监听控件!
- 带时分秒的flex3日历选择器---完善版
- 乔布斯曾想利用Wi-Fi频谱为iPhone单独打造一个移动网络
- applicationContext.xml读取properties中属性
- xwork 各版本下载地址
- java 泛型
- 网络编程常见问题总结
- Http与Socket连接区别
- 关于boost的regex库和xpressive库匹配所有标点(含中文标点)的方法
- nutch安装、配置和使用
- MigBot代码补丁技术的源代码过程讲解
- 彻底解决COM端口被占用(在使用中)问题的办法