ITeye博客

spring的PropertyPlaceholderConfigurer 指向工程外路径

leichenlei · 2014-11-25 17:25 · java_framework_spring · 编程语言 · Markdown

spring的properties文件一般会放到classpath下。最近有个项目是使用spring,但是是打成jar执行的。

 

config.properties 和jar放到同一个目录,为了让spring读到 config文件,使用下面的配置:

 

 

 

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="order" value="1" />
		<property name="systemPropertiesMode">  
			<value>1</value>  
		</property>
		<property name="locations">
			<list>
				<value>file:${user.dir}/config.properties</value>
			</list>
		</property>
	</bean>

评论(0)

暂无评论。

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