title: Is there a way to check if a bean is defined in spring context?
body: <p>I am trying to create an object factory, which will first check if a bean has been specifically define in spring context. If such a bean is not found, It would check for other ways to create the instance.</p>
  
  <p>I have implemented it using the following code</p>
  
  <pre><code>try {
          component = (PageComponent) appContext.getBean(w.getName());
      } catch (org.springframework.beans.factory.NoSuchBeanDefinitionException e) {
              component = loadFromDB(w, page);
      }
  </code></pre>
  
  <p>It is working, however an exception object is created whenever the bean is not available in Spring Context.</p>
  
  <p>Is there a way to avoid this? or in other words Is there a way to check if a bean is defined in spring context?</p>