|
From: Thomas R. <tho...@tr...> - 2005-05-02 02:16:26
|
Mark, I guess we need a way for the container to figure out that you want a pair of objects referring to each other. What happens if you do this: <beans> <bean id="myClassA" class="com.foo.ClassA" singleton="false"> <property name="classB"> <bean class="com.foo.ClassB"> <property name="classA"> <ref local="myClassA"/> </property> </bean> </property> </bean> </beans> Thomas On May 1, 2005, at 8:39 PM, Mark Pollack wrote: > Hi, > > I get a StackOverflowError when using the following context definition > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" > "http://www.springframework.org/dtd/spring-beans.dtd"> > <beans> > <bean id="myClassA" class="com.foo.ClassA" singleton="false"> > <property name="classB"><ref > local="myClassB"/></property> > </bean> > > <bean id="myClassB" class="com.foo.ClassB" singleton="false"> > <property name="classA"><ref > local="myClassA"/></property> > </bean> > </beans> > > And the code > > ApplicationContext ctx = new > FileSystemXmlApplicationContext("appContext.xml"); > ClassA ca = (ClassA) ctx.getBean("myClassA"); > > > Note that they are both prototypes. The classes are very plain - > ClassA > has a property ClassB and vice versa and that is all. I'm using the > code from CVS. What is the opinion on trying to detect this situation? > > Cheers, > Mark > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great > events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |