[英]How to load properties file using system properties
I have a properties file which sits on APPSERVERS HOME directory(JBOSS_HOME/PROJECT_PROPERTIES/abc.properties).PROJECT_PROPERTIES is the directory where we are keeping all the project related property files.I need to read this properties file from spring config.Earlier i was using the following approach.我有一个位于 APPSERVERS HOME 目录(JBOSS_HOME/PROJECT_PROPERTIES/abc.properties)上的属性文件。PROJECT_PROPERTIES 是我们保存所有项目相关属性文件的目录。我需要从 spring 配置中读取此属性文件。我之前是使用以下方法。
<bean id="propertyOverrideConfigurer"
class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
<property name="location" value="classpath:abc.properties" />
Now we moved all our properties file to JBOSS_HOME/PROJECT_PROPERTIES directory.现在我们将所有属性文件移动到 JBOSS_HOME/PROJECT_PROPERTIES 目录。
Please provide me some pointers how to access the properties file using spring.请提供一些指示如何使用 spring 访问属性文件。
This should help you out:这应该可以帮助您:
You can pass the properties file path as a command line argument您可以将属性文件路径作为命令行参数传递
<property name="location" value="${propertiesFile}" />
Then for the jvm parameters pass然后为jvm参数传递
-DpropertiesFile=my/configuration/file.properties
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.