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

加入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}"/>



posted @ 2011-12-28 10:30  tazi  阅读(262)  评论(0编辑  收藏  举报