|
From: Jozsa K. <dy...@on...> - 2004-06-03 12:59:16
|
Ok. My point was to add the shutdown hook thing for=20 ClassPathXmlApplicationContext, but maybe some won't like this=20 functionality, so I'll do it myself within my app / abstract testcase. Thanks for the explanation, dyn j=FCrgen h=F6ller [werk3AT] wrote: > If Spring manages your application context, like in the web app or EJB = case, the respective context loaders will properly close the context on s= hutdown. >=20 > If you're instantiating your own context, like a ClassPathXmlApplicatio= nContext, you're responsible for closing it on shutdown of your app. This= typically happens in the lifecycle code of a standalone app. >=20 > ConfigurableApplicationContext context =3D new ClassPathXmlApplicationC= ontext(...); > // run app > context.close(); >=20 > Nevertheless, none of your application objects in the context need to k= now about the ConfigurableApplicationContext interface. If at all, they w= ork with the ApplicationContext interface. >=20 > Juergen >=20 >=20 > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...]On Behalf > Of Jozsa Kristof > Sent: Thursday, June 03, 2004 2:19 PM > To: spr...@li... > Subject: Re: [Springframework-developer] about closing bean container >=20 >=20 > Ok.. and what about disposing the container's singletons from a shutdow= n=20 > hook for non-web apps? If close() is not meant for the client view of=20 > the context, than the server should take care about it imho. >=20 > dyn >=20 > j=FCrgen h=F6ller [werk3AT] wrote: >=20 >>It's not in the ApplicationContext interface itself, because this is me= ant to be a client view of the context. Simply cast the context reference= to ConfigurableApplicationContext; you can then invoke the close method = there. >> >>Juergen >> >> >>-----Original Message----- >>From: spr...@li... >>[mailto:spr...@li...]On Behalf >>Of Jozsa Kristof >>Sent: Thursday, June 03, 2004 1:14 PM >>To: spr...@li... >>Subject: [Springframework-developer] about closing bean container >> >> >>Hi, >> >>I started to wonder today why ApplicationContext interface doesn't=20 >>include the close() method to dispose the singleton beans in the bean=20 >>container. Is there any reason not to expose this method? On the other=20 >>side, wouldn't it make sense to add a shutdown hook to clear up any=20 >>still-existing bean containers at least on jvm exit? >> >>dyn >=20 >=20 >=20 --=20 .Digital.Yearning.for.Networked.Assassination.and.Xenocide. |