How to set a system property with Spring

The following Spring bean entry will set the system property your.system.property to The_System_Property_Value.

You can have as many <prop /> elements as you need.

<!--
This bean adds the xml.catalog.files from the kms config into the system properties.
-->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetObject">
                <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
                        <property name="targetClass" value="java.lang.System" />
                        <property name="targetMethod" value="getProperties" />
                </bean>
        </property>
        <property name="targetMethod" value="putAll" />
        <property name="arguments">
                <util:properties>
                        <prop key="your.system.property">The_System_Property_Value</prop>
                </util:properties>
        </property>
</bean>

References

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.