If you want to set system properties through XML configuration, here is a solution (inspired by this question):
Use two MethodInvokingFactorybeans, one to statically access System.getProperties() and one to call properties.putAll(map) on these properties. Here’s the configuration:
<bean
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property
name="targetObject">
<!-- System.getProperties() -->
<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">
<!-- The new Properties -->
<util:properties>
<prop
key="my.key">myvalue</prop>
<prop
key="my.key2">myvalue2</prop>
<prop
key="my.key3">myvalue3</prop>
</util:properties>
</property>
</bean>
Of course I am not saying this is a best practice (far from it). But it’s probably the easiest way to add system properties using XML only.

Just pasted the code as-is ; getting an error “The prefix “util” for element “util:properties” is not bound.” . Is util a custom namespace? . I’m using Spring 3.0.6.
Thanks,
springer
It’s one of the standard Spring namespaces, but you have to activate it:
<?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-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<!-- define beans here -->
</beans>