We can invoke static methods in Spring by using MethodInvokingFactoryBean. This is a factoryBean which returns a value which is the result of a static or instance method invocation. To use this bean, you define the bean in the application context xml and configure three properties
1) targetClass - this is the class on which the static method need to be invoked
2) targetMethod - this is the name of the static method
3) arguments - you can list the arguments passed to the static method as parameters
The example below is taken from the Spring API reference.
This example talks about calling a static method then an instance method to get at a Java system property.
1) targetClass - this is the class on which the static method need to be invoked
2) targetMethod - this is the name of the static method
3) arguments - you can list the arguments passed to the static method as parameters
The example below is taken from the Spring API reference.
This example talks about calling a static method then an instance method to get at a Java system property.
java.lang.System getProperties getProperty
java.version