Hello.
I have such a situation: 3 bins are defined in the context. 2 of them are classes of my application (both Runnable
), and 3 are ArrayList
. In the first 2 bins there is a link to this bin- ArrayList
. I want to add components to this ArrayList
in 1 bin, wait for the addition to be completed, then raise the 2nd bin and use the values from this ArrayList
. Will such a construction work, is it correct to do this at all?
<bean name="firstbean" class="com.fistbean"> <property name="list" ref="mainlist" /> </bean> <bean name="secondbean" class="com.secondbean"> <property name="list" ref="mainlist" /> </bean> <bean name="mainlist" class="java.util.ArrayList"> </bean>
After that, I do this:
FirstBean f = ObjectFactory.getObject("firstbean"); f.start() // Тут происходит добавления в ArrayList f.join(); SecondBean s = ObjectFactory.getObject("secondbean"); s.start();// Тут из этого ArrayList читаются значения
Something like this :)