Skip to content

Instantly share code, notes, and snippets.

@bulain
Created August 11, 2011 14:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save bulain/1139874 to your computer and use it in GitHub Desktop.
Save bulain/1139874 to your computer and use it in GitHub Desktop.
calling static and instance method in spring
<!-- call static method -->
<bean id="test" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="demo.Test" />
<property name="targetMethod" value="staticmethod" />
<property name="arguments">
<list>
<value>test</value>
</list>
</property>
</bean>
<!-- call instance method -->
<bean id="test" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="instance" />
<property name="targetMethod" value="instancemethod" />
<property name="arguments">
<list>
<value>test</value>
</list>
</property>
</bean>
@bobguo
Copy link

bobguo commented Oct 20, 2011

good!

@renchuqiao
Copy link

renchuqiao commented Aug 4, 2016

very nice! thanks for sharing!

@qfrank
Copy link

qfrank commented Apr 13, 2020

great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment