Package org.springframework.beans

Examples of org.springframework.beans.BeanInstantiationException


    if (beanDefinition.getMethodOverrides().isEmpty()) {
      Constructor constructorToUse = (Constructor) beanDefinition.resolvedConstructorOrFactoryMethod;
      if (constructorToUse == null) {
        final Class clazz = beanDefinition.getBeanClass();
        if (clazz.isInterface()) {
          throw new BeanInstantiationException(clazz, "Specified class is an interface");
        }
        try {
          if (System.getSecurityManager() != null) {
            constructorToUse = AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor>() {
              public Constructor run() throws Exception {
                return clazz.getDeclaredConstructor((Class[]) null);
              }
            });
          } else {
            constructorToUse =  clazz.getDeclaredConstructor((Class[]) null);
          }
          beanDefinition.resolvedConstructorOrFactoryMethod = constructorToUse;
        }
        catch (Exception ex) {
          throw new BeanInstantiationException(clazz, "No default constructor found", ex);
        }
      }
      return BeanUtils.instantiateClass(constructorToUse);
    }
    else {
View Full Code Here


      synchronized (beanDefinition.constructorArgumentLock) {
        constructorToUse = (Constructor<?>) beanDefinition.resolvedConstructorOrFactoryMethod;
        if (constructorToUse == null) {
          final Class clazz = beanDefinition.getBeanClass();
          if (clazz.isInterface()) {
            throw new BeanInstantiationException(clazz, "Specified class is an interface");
          }
          try {
            if (System.getSecurityManager() != null) {
              constructorToUse = AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor>() {
                public Constructor run() throws Exception {
                  return clazz.getDeclaredConstructor((Class[]) null);
                }
              });
            }
            else {
              constructorToUse =  clazz.getDeclaredConstructor((Class[]) null);
            }
            beanDefinition.resolvedConstructorOrFactoryMethod = constructorToUse;
          }
          catch (Exception ex) {
            throw new BeanInstantiationException(clazz, "No default constructor found", ex);
          }
        }
      }
      return BeanUtils.instantiateClass(constructorToUse);
    }
View Full Code Here

        target = factoryBean.getObject();
      }
      catch (Exception e) {
        String errorMessage = "Failed getting object from factory bean " + factoryBean + ", bean name "
            + beanName;
        throw new BeanInstantiationException(factoryBean.getObjectType(), errorMessage, e);
      }
    }
    else {
      target = bean;
    }
View Full Code Here

        target = factoryBean.getObject();
      }
      catch (Exception e) {
        String errorMessage = "Failed getting object from factory bean " + factoryBean + ", bean name "
            + beanName;
        throw new BeanInstantiationException(factoryBean.getObjectType(), errorMessage, e);
      }
    }
    else {
      target = bean;
    }
View Full Code Here

    if (beanDefinition.getMethodOverrides().isEmpty()) {
      Constructor constructorToUse = (Constructor) beanDefinition.resolvedConstructorOrFactoryMethod;
      if (constructorToUse == null) {
        Class clazz = beanDefinition.getBeanClass();
        if (clazz.isInterface()) {
          throw new BeanInstantiationException(clazz, "Specified class is an interface");
        }
        try {
          constructorToUse = clazz.getDeclaredConstructor((Class[]) null);
          beanDefinition.resolvedConstructorOrFactoryMethod = constructorToUse;
        }
        catch (Exception ex) {
          throw new BeanInstantiationException(clazz, "No default constructor found", ex);
        }
      }
      return BeanUtils.instantiateClass(constructorToUse, null);
    }
    else {
View Full Code Here

    public void setCamelContext(CamelContext camelContext) {
        this.camelContext = camelContext;
        postProcessor = new CamelPostProcessorHelper(camelContext) {
            @Override
            protected RuntimeException createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, Exception e) {
                return new BeanInstantiationException(type, "Could not instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
            }
        };
    }
View Full Code Here

    public void setCamelContext(CamelContext camelContext) {
        this.camelContext = camelContext;
        postProcessor = new CamelPostProcessorHelper(camelContext) {
            @Override
            protected RuntimeException createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, Exception e) {
                return new BeanInstantiationException(type, "Could not instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
            }
        };
    }
View Full Code Here

    public void setCamelContext(CamelContext camelContext) {
        this.camelContext = camelContext;
        postProcessor = new CamelPostProcessorHelper(camelContext) {
            @Override
            protected RuntimeException createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, Exception e) {
                return new BeanInstantiationException(type, "Could not instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
            }
        };
    }
View Full Code Here

                    return getOrLookupCamelContext();
                }

                @Override
                protected RuntimeException createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, Exception e) {
                    return new BeanInstantiationException(type, "Could not instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
                }

                protected boolean isSingleton(Object bean, String beanName) {
                    // no application context has been injected which means the bean
                    // has not been enlisted in Spring application context
View Full Code Here

    if (beanDefinition.getMethodOverrides().isEmpty()) {
      Constructor constructorToUse = (Constructor) beanDefinition.resolvedConstructorOrFactoryMethod;
      if (constructorToUse == null) {
        Class clazz = beanDefinition.getBeanClass();
        if (clazz.isInterface()) {
          throw new BeanInstantiationException(clazz, "Specified class is an interface");
        }
        try {
          constructorToUse = clazz.getDeclaredConstructor((Class[]) null);
          beanDefinition.resolvedConstructorOrFactoryMethod = constructorToUse;
        }
        catch (Exception ex) {
          throw new BeanInstantiationException(clazz, "No default constructor found", ex);
        }
      }
      return BeanUtils.instantiateClass(constructorToUse, null);
    }
    else {
View Full Code Here

TOP

Related Classes of org.springframework.beans.BeanInstantiationException

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.