Hi All,
I've following requirement:
Method A1 of Bean A needs to call method B1 of bean B. But this should happen without putting call to "getBean ('B') and calling B.B1().
I tried the following in the context xml file :
<bean id="TestFactory" class="org.springframework.beans.factory.config.Me thodInvokingFactoryBean">
<property name="targetObject"><ref local="refOfBeanB"/></property>
<property name="targetMethod"><value>B1</value></property>
</bean>
But the call to B.B1 happens when I read the XML by "ClassPathXmlApplicationContext". (i.e. at the start time)
I need the control to call "B.B1()" in the method "A.A1()".
Can this be achieved with context xml?(in declarative fashion)
Or I need to get the bean reference explicitely in A1() like this :
getBean("B");
call to B1();
Any help is appreciated.
thanks,
anagha


Reply With Quote