|
From: <jue...@we...> - 2003-11-19 21:12:20
|
Why not use ListableBeanFactory's getBeanDefinitionNames method? If the = returned String array contains the bean name, then it is available in = the factory. =20 It would still make sense to add a containsBean method to BeanFactory, I = guess, to avoid workarounds like isSingleton or getAliases checks. If = noone objects, I'll do that - is that OK with you, Darren? Rod, what do = you think? =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Kopylenko, Dmitry Gesendet: Mi 19.11.2003 21:46 An: 'spr...@li...' Betreff: RE: [Springframework-developer] how to determine if a bean = exists in registry? If there is a big demand for such a "query" method I could add it to = BeanFactory or AbstractBeanFactory. What everybody thinks? =20 Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...]=20 Sent: Wednesday, November 19, 2003 3:42 PM To: spr...@li... Subject: Re: [Springframework-developer] how to determine if a bean = exists in registry? =09 =09 Although, I would still prefer a simpler method that just returns a = boolean, but your solution will work for me. =20 Thanks!!!! =20 =20 ----- Original Message -----=20 From: Dmitriy Kopylenko <mailto:dko...@ru...> =20 To: spr...@li...=20 Sent: Wednesday, November 19, 2003 11:15 AM Subject: RE: [Springframework-developer] how to determine if a bean = exists in registry? Or better yet use AbstractBeanFactory.getBeanDefinition(String = beanName) which would throw NoSuchBeanDefinitionException if bean does = not exist. =20 Regards, Dmitriy. -----Original Message----- From: spr...@li... = [mailto:spr...@li...] On Behalf = Of Kopylenko, Dmitry Sent: Wednesday, November 19, 2003 2:08 PM To: 'spr...@li...' Subject: RE: [Springframework-developer] how to determine if a bean = exists in registry? =09 =09 Rajeev, =20 you could use String[] getAliases(String name) throws = NoSuchBeanDefinitionException in BeanFactory and catch = NoSuchBeanDefinitionException. If caught, then bean does not exist in = the factory. =20 Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...]=20 Sent: Wednesday, November 19, 2003 1:54 PM To: spr...@li... Subject: [Springframework-developer] how to determine if a bean = exists in registry? =09 =09 Is there an easy way to determine if a certain bean exists in the = beanFactory? I know one can use the getBean(name) to determine that, = but it seems an expensive call, especially, if there are bean post = processors associated with it. Don't you think having a function like = boolean containsBean(String beanName) in a beanFactory class would be = useful here? =20 Rajeev Kaul =09 |