`
yhz61010
  • 浏览: 551426 次
  • 来自: -
博客专栏
63c13ecc-ef01-31cf-984e-de461c7dfde8
libgdx 游戏开发
浏览量:11979
社区版块
存档分类
最新评论

[原创] Spring 配置文件中如何读取系统环境变量

阅读更多
假设我们想读取 jboss home,配置文件中的写法如下:
<bean id="wroProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    <property name="location" value="file:#{systemProperties['jboss.home.dir']}/standalone/configuration/wro.properties" />  
</bean>

注意其中的:file:#{systemProperties['jboss.home.dir']} 部分。
因为 jboss 在启动时,会将 JBOSS_HOME 变量的值赋给 jboss.home.dir 变量,所以在配置文件中,获取 jboss.home.dir 的值即可。
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics