Skip to content

Instantly share code, notes, and snippets.

@gembin
Forked from jcarlosgarcia/gist:1621770
Created November 22, 2024 20:53
Show Gist options
  • Save gembin/6b1ad9bfb8095edcb15af8446862c0a0 to your computer and use it in GitHub Desktop.
Save gembin/6b1ad9bfb8095edcb15af8446862c0a0 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