Dilip
Dilip

Reputation: 959

Spring issues with JVM Arguments

I have a normal plain servlet . I am trying to load property file from the file system using Spring ReloadableResourceBundleMessageSource class.The file location is supplied by the JVM arguments. The following is my declaration of my MessageSource bean

<bean id="xmlXpathProperties" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <!-- check property file(s) every 600 second(10min) -->
        <property name="cacheSeconds" value="600"/>
        <property name="basenames">
            <list>
                <value>file:#{systemProperties.aircdrconfig}/cdr-airxml</value>
            </list>
        </property>
/bean>

If i am giving the JVM argument name with any special characters such as dots(.) or hyphen(-) for example : air.cdr.config, I am getting an exception like.

org.springframework.beans.factory.BeanExpressionException Field or property 'air' cannot be found on object of type 'java.util.Properties'

If i remove the dot symbol then it's working fine. Any idea to overcome this problem? Thanks in advance.

Upvotes: 0

Views: 2101

Answers (1)

Biju Kunjummen
Biju Kunjummen

Reputation: 49915

You will need to refer to the properties this way:

#{ systemProperties['air.cdr.config'] }

Upvotes: 3

Related Questions