Wednesday 21 April 2010

Using Spring with a static method

Here an instance of MyClass has the result of the static method 'getPlatformMBeanServer()' passed in to it's constructor.

Sample code:


<bean id="registry" class="com.mypackage.MyClass">

  <constructor-arg>

    <bean factory-method="getPlatformMBeanServer" class="java.lang.management.ManagementFactory" />

  </constructor-arg>

</bean>

No comments:

Post a Comment