您的位置:首页 > 编程语言 > Java开发

Spring的配置文件中使用属性文件

2011-12-28 10:30 190 查看
加入context命名空间

xmlns:context="http://www.springframework.org/schema/context"


和xsi:schemaLocation中加上
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd

然后使用

<context:property-placeholder location="classpath:jdbc.properties"/>导入属性文件

可以使用${属性key}

如:

<property name="username" value="${username}"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐