|
From: Mark P. <Mar...@co...> - 2005-05-02 11:14:02
|
Hi, Same thing. Inspired by a solution on the Spring Java forums, I ended up creating a object post processor to wire it up for now. See http://forum.springframework.net/viewtopic.php?t=3D100 for that = approach.=20 - Mark > -----Original Message----- > From: spr...@li...=20 > [mailto:spr...@li...] > On Behalf Of Thomas Risberg > Sent: Sunday, May 01, 2005 10:16 PM > To: spr...@li... > Subject: Re: [Springframework-developer] StackOverflowError >=20 >=20 > Mark, >=20 > I guess we need a way for the container to figure out that you want a=20 > pair of objects referring to each other. >=20 > What happens if you do this: >=20 > <beans> >=20 > <bean id=3D"myClassA" class=3D"com.foo.ClassA" singleton=3D"false"> > <property name=3D"classB"> > <bean class=3D"com.foo.ClassB"> > <property name=3D"classA"> > <ref local=3D"myClassA"/> > </property> > </bean> > </property> > </bean> > =09 > </beans> >=20 > Thomas >=20 > On May 1, 2005, at 8:39 PM, Mark Pollack wrote: >=20 > > Hi, > > > > I get a StackOverflowError when using the following context=20 > definition > > > > <?xml version=3D"1.0" encoding=3D"UTF-8"?> > > <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"=20 > > "http://www.springframework.org/dtd/spring-beans.dtd"> > > <beans> > > <bean id=3D"myClassA" class=3D"com.foo.ClassA" singleton=3D"false"> > > <property name=3D"classB"><ref > > local=3D"myClassB"/></property> > > </bean> > > =09 > > <bean id=3D"myClassB" class=3D"com.foo.ClassB" singleton=3D"false"> > > <property name=3D"classA"><ref > > local=3D"myClassA"/></property> > > </bean> > > </beans> > > > > And the code > > > > ApplicationContext ctx =3D new=20 > > FileSystemXmlApplicationContext("appContext.xml"); > > ClassA ca =3D (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=20 > 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=20 > Games. Play to > > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > >=20 > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4=20 > great events, 4 opportunities to win big! Highest score=20 > wins.NEC IT Guy Games. Play to win an NEC 61 plasma display.=20 > Visit http://www.necitguy.com/?r=3D20=20 > _______________________________________________ > Springframework-developer mailing list=20 > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer >=20 >=20 |