hI,
If we need to call a method that takes in a parameter(obj,primitive types) in the bean attibute : init-method
hw do we do it??
Regards
hI,
If we need to call a method that takes in a parameter(obj,primitive types) in the bean attibute : init-method
hw do we do it??
Regards
suppose we need to invoke a method ....lie init-method ..where in we need to pass few paramaters...
how??
You can create a FactoryBean for objects that are difficult to set up in Spring.
But you can also use the MethodInvokingFactoryBean to deal with method invokes.
blog: http://pveentjer.wordpress.com project: STM Implementation http://multiverse.googlecode.com
If you are using this in a class you are writing, you could also inject all the properties that you need to pass to the method and have an init method that just forwards to the real method. eg.
<bean id="foo" class="foo.bar" init-method="init">
<property name="obj1" ref="beanObject" /></bean>
<property name="primitiveVal" ref="17" />
public void init(){
yourMethod(obj1, primitiveVal);}