|
From: Kopylenko, D. <dko...@ac...> - 2003-11-19 20:46:51
|
If there is a big demand for such a "query" method I could add it to BeanFactory or AbstractBeanFactory. What everybody thinks? Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...] Sent: Wednesday, November 19, 2003 3:42 PM To: spr...@li... Subject: Re: [Springframework-developer] how to determine if a bean exists in registry? Although, I would still prefer a simpler method that just returns a boolean, but your solution will work for me. Thanks!!!! ----- Original Message ----- From: Dmitriy <mailto:dko...@ru...> Kopylenko To: spr...@li... <mailto:spr...@li...> 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. Regards, Dmitriy. -----Original Message----- From: spr...@li... <mailto: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? Rajeev, you could use String[] getAliases(String name) throws NoSuchBeanDefinitionException in BeanFactory and catch NoSuchBeanDefinitionException. If caught, then bean does not exist in the factory. Dmitriy. -----Original Message----- From: Rajeev Kaul [mailto:Ra...@cu...] Sent: Wednesday, November 19, 2003 1:54 PM To: spr...@li... Subject: [Springframework-developer] how to determine if a bean exists in registry? 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? Rajeev Kaul |