Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.NoSuchBeanDefinitionException


        return getBean(name, null);
    }
    public Object getBean(String name, Class requiredType) throws BeansException {
        Object bean = beans.get(name);
        if (bean == null) {
            throw new NoSuchBeanDefinitionException(name);
        }
        if (requiredType != null && !requiredType.isInstance(bean)) {
            throw new BeanNotOfRequiredTypeException(name, requiredType, bean.getClass());
        }
        return bean;
View Full Code Here


        return bean;
    }
    public Class getType(String name) throws NoSuchBeanDefinitionException {
        Object bean = beans.get(name);
        if (bean == null) {
            throw new NoSuchBeanDefinitionException(name);
        }
        return bean.getClass();
    }
View Full Code Here

        return bean.getClass();
    }
    public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
        Object bean = beans.get(name);
        if (bean == null) {
            throw new NoSuchBeanDefinitionException(name);
        }
        return true;
    }
View Full Code Here

        }
        return true;
    }
    public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
        if (!beans.containsKey(name)) {
            throw new NoSuchBeanDefinitionException(name);
        }
        if (targetType == null || Object.class.equals(targetType)) {
            return true;
        }
        return targetType.isAssignableFrom(beans.get(name).getClass());
View Full Code Here

        try {
            setContext("<http auto-config='true' />");
        } catch (BeanCreationException e) {
            Throwable cause = ultimateCause(e);
            assertTrue(cause instanceof NoSuchBeanDefinitionException);
            NoSuchBeanDefinitionException nsbe = (NoSuchBeanDefinitionException) cause;
            assertEquals(BeanIds.AUTHENTICATION_MANAGER, nsbe.getBeanName());
            assertTrue(nsbe.getMessage().endsWith(AuthenticationManagerFactoryBean.MISSING_BEAN_ERROR_MESSAGE));
        }
    }
View Full Code Here

                    Assert.state(beanFactory != null, "BeanFactory must be set to resolve " + authMgrBean);
                    try {
                        delegate = beanFactory.getBean(authMgrBean, AuthenticationManager.class);
                    } catch (NoSuchBeanDefinitionException e) {
                        if (BeanIds.AUTHENTICATION_MANAGER.equals(e.getBeanName())) {
                            throw new NoSuchBeanDefinitionException(BeanIds.AUTHENTICATION_MANAGER,
                                AuthenticationManagerFactoryBean.MISSING_BEAN_ERROR_MESSAGE);
                        }
                        throw e;
                    }
                }
View Full Code Here

    public AuthenticationManager getObject() throws Exception {
        try {
             return (AuthenticationManager) bf.getBean(BeanIds.AUTHENTICATION_MANAGER);
        } catch (NoSuchBeanDefinitionException e) {
            if (BeanIds.AUTHENTICATION_MANAGER.equals(e.getBeanName())) {
                throw new NoSuchBeanDefinitionException(BeanIds.AUTHENTICATION_MANAGER, MISSING_BEAN_ERROR_MESSAGE);
            }
            throw e;
        }
    }
View Full Code Here

                }
                Properties existingHibernateProperties = (Properties) propertyValue.getValue();
                existingHibernateProperties.putAll(hibernateProperties);
            }
        } else {
            throw new NoSuchBeanDefinitionException("No bean named [" + sessionFactoryBeanName
                    + "] exists within the bean factory. "
                    + "Cannot post process session factory to add Hibernate resource definitions.");
        }
    }
View Full Code Here

            }

            return (T)matchedTypes.values().toArray()[0];
        }
       
        throw new NoSuchBeanDefinitionException(beanType.getName());
    }
View Full Code Here

        ((ConfigurableBeanFactory) this.beanFactory).registerDependentBean(unitName, requestingBeanName);
      }
      return emf;
    }
    else {
      throw new NoSuchBeanDefinitionException(
          EntityManagerFactory.class, "expected single bean but found " + beanNames.length);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.NoSuchBeanDefinitionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.