Skip to content

Instantly share code, notes, and snippets.

@jcarlosgarcia
Created January 16, 2012 16:55
Show Gist options
  • Save jcarlosgarcia/1621770 to your computer and use it in GitHub Desktop.
Save jcarlosgarcia/1621770 to your computer and use it in GitHub Desktop.
Set system properties via Spring XML configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<bean id="systemProps" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" value="#{@systemProperties}" />
<property name="targetMethod" value="putAll" />
<property name="arguments">
<util:properties>
<prop key="myprop1">myvalue1</prop>
<prop key="myprop2">myvalue2</prop>
<prop key="mypropN">myvalueN</prop>
</util:properties>
</property>
</bean>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment