Pages

Monday, November 1, 2010

Referencing system property in Spring XML config

It have took me quite a bit of time to found this way. So I've decided to write it in some publicly available place and remembered that some time ago I've created this blog. I think it is the proper place. And also in the official documentation this is done with creating two beans - I've done it with only one.


<bean id="javaTmpDir" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" autowire-candidate="false">
  <property name="targetClass"><value>java.lang.System</value></property>
  <property name="targetMethod"><value>getProperty</value></property>
  <property name="arguments">
   <list>
    <value>java.io.tmpdir</value>
   </list>
  </property>
</bean>


* This source code was highlighted with Source Code Highlighter.

First message in blog is usually something ugly. I hope that possible future posts will be more  curious ;-)

No comments:

Post a Comment