Package org.springframework.beans.factory

Examples of org.springframework.beans.factory.BeanCreationException


    @Override
    public HiveClient getHiveClient() throws BeansException {
      try {
        return createHiveClient();
      } catch (Exception ex) {
        throw new BeanCreationException("Cannot create HiveClient instance", ex);
      }
    }
View Full Code Here


    @Override
    public PigServer getPigServer() {
      try {
        return createPigInstance();
      } catch (Exception ex) {
        throw new BeanCreationException("Cannot create PigServer instance", ex);
      }
    }
View Full Code Here

    try {
      for (int i = 0; i < split.length; i++) {
        nodes.add(new URI("http://" + split[i] + ":8091/pools"));
      }
    } catch (URISyntaxException ex) {
      throw new BeanCreationException("Could not convert host list." + ex);
    }

    return nodes;
  }
View Full Code Here

                    }
                }
            } catch (IOException ex) {
                throw new BeanDefinitionStoreException("I/O failure during classpath scanning", ex);
            } catch (ClassNotFoundException ex) {
                throw new BeanCreationException("Failed to create bean from classfile", ex);
            }
               
            if (bus == null) {
                setBus(BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx));
            }
View Full Code Here

    if(beanDefinition.getBeanClassName() != null){
      //with CLASS_ATTRIBUTE
      interfaces = beanDefinition.getBeanClass().getInterfaces();
     
      if(! GenericEntityDao.class.isAssignableFrom(beanDefinition.getBeanClass()))
        throw new BeanCreationException("{} is not a valid GenericEntityDao bean.", element.getAttribute(ID_ATTRIBUTE));
     
      //override abstract method
      Method[] methods = beanDefinition.getBeanClass().getMethods();
      for (Method method : methods) {
        if (Modifier.isAbstract(method.getModifiers())) {
          beanDefinition.getMethodOverrides().addOverride(
              new ReplaceOverride(method.getName(), null));
        }
      }
    }else if(element.hasAttribute(INTERFACE_ATTRIBUTE)){
        try {
          Class<?> iClazz = ClassUtils.forName(element.getAttribute(INTERFACE_ATTRIBUTE), getClass().getClassLoader());       
          interfaces = new Class<?>[]{iClazz, ModelClassSupport.class};
         
          if (GenericEntityDao.class.isAssignableFrom(iClazz)) {
            beanDefinition = new RootBeanDefinition(SimpleModelClassSupport.class);
            beanDefinition.getPropertyValues().addPropertyValue("modelClass",getGenericModelClass(iClazz));
          }else{
            throw new BeanCreationException("{} is not a valid GenericEntityDao Interface.", element.getAttribute(ID_ATTRIBUTE));
          }
        } catch (ClassNotFoundException e) {
          e.printStackTrace();
          throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
        } catch (LinkageError e) {
          e.printStackTrace();
          throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
        }
    }else{
      throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
    }
   
    AbstractBeanDefinition rootDefinition = new GenericBeanDefinition();
    rootDefinition.setParentName("parentGenericDaoProxy");
    rootDefinition.getPropertyValues().addPropertyValue("proxyInterfaces",interfaces);
View Full Code Here

      String beanName = getBeanName(clazz);
      AbstractBeanDefinition targetBean;     
      if(clazz.isInterface()){
        logger.debug("Add Interface '{}' to '{}'.", className, beanName)
        Class<?> targetType = getGenericModelClass(clazz);
        if(targetType == null) throw new BeanCreationException("{} is not a valid GenericEntityDao bean.", beanName);
       
        targetBean = new RootBeanDefinition(SimpleModelClassSupport.class);
        targetBean.getPropertyValues().addPropertyValue("modelClass",targetType);
        interfaces = new Class<?>[]{clazz, ModelClassSupport.class};
      }else{
View Full Code Here

        } else if (requiredChannel.equals(OPT_REQUIRES_HTTP)) {
            channelConfigAttribute = "REQUIRES_INSECURE_CHANNEL";
        } else if (requiredChannel.equals(OPT_ANY_CHANNEL)) {
            channelConfigAttribute = ChannelDecisionManagerImpl.ANY_CHANNEL;
        } else {
            throw new BeanCreationException("Unknown channel attribute " + requiredChannel);
        }

        return SecurityConfig.createList(channelConfigAttribute);
    }
View Full Code Here

                InitializingBean initializingBean = (InitializingBean) defaultStrategy;
                try {
                    initializingBean.afterPropertiesSet();
                }
                catch (Exception ex) {
                    throw new BeanCreationException("Invocation of init method failed", ex);
                }
            }
            return defaultStrategy;
        }
    }
View Full Code Here

            InitializingBean initializingBean = (InitializingBean) strategy;
            try {
                initializingBean.afterPropertiesSet();
            }
            catch (Throwable ex) {
                throw new BeanCreationException("Invocation of init method failed", ex);
            }
        }
        return strategy;
    }
View Full Code Here

     * 功能描述:设置应用程序上下文对象。
     * @param context 待设置的应用程序上下文对象。
     */
    public void setApplicationContext(final ApplicationContext context) throws BeansException {
        if (applicationContext != null) {
            throw new BeanCreationException("ApplicationContextHolder already holded 'applicationContext'.");
        }
       
        applicationContext = context;
        log.info("holded applicationContext,displayName:" + applicationContext.getDisplayName());
    }
View Full Code Here

TOP

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

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.