ITeye博客

Spring中的资源文件(.properties)管理类

ozzzo · 2009-08-11 17:21 · Spring · Markdown

在spring的配置文件中加入


<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
   <property name="locations">
	  <value>classpath:oracle10g.properties</value>
   </property> 
</bean>

oracle10g.properties为src目录下的一个配置文件 在需要引入的地方直接写${properties文件中的key值} 例如:


<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}"></property>

可以让spring中的配置文件看起来简洁.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。