`
leichenlei
  • 浏览: 124413 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

spring的PropertyPlaceholderConfigurer 指向工程外路径

 
阅读更多

 

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>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics