Package org.springframework.beans

Examples of org.springframework.beans.BeanInstantiationException


        this.persistenceManager = persistenceManager;
    }
   
    public void afterPropertiesSet() throws Exception {
        if (this.persistenceManager == null) {
            throw new BeanInstantiationException(this.getClass(), "No persistence manager found!");
        }
    }
View Full Code Here


        if (this.prevalenceBase != null) {
            this.prevalenceBase = this.resourceLoader.getResource(this.prevalenceBase).getFile().getCanonicalPath();
        }
       
        if (this.prevalentSystem == null) {
            throw new BeanInstantiationException(this.getClass(), "No prevalent system found!");
        }
       
        PrevaylerFactory factory = new PrevaylerFactory();
        factory.configureClock(this.clock);
        factory.configurePrevalenceBase(this.prevalenceBase);
View Full Code Here

    public void setCamelContext(SpringCamelContext 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

        // Don't override the class with CGLIB if no overrides.
        if (beanDefinition.getMethodOverrides().isEmpty()) {
            Class clazz = beanDefinition.getBeanClass();
            if (clazz.isInterface()) {
                throw new BeanInstantiationException(clazz, "Specified class is an interface");
            }
            try {
                Constructor constructor = clazz.getDeclaredConstructor((Class[]) null);
                return BeanUtils.instantiateClass(constructor, null);
            }
            catch (Exception ex) {
                throw new BeanInstantiationException(clazz, "No default constructor found", ex);
            }
        } else {
            // Must generate CGLIB subclass.
            return instantiateWithMethodInjection(beanDefinition, beanName, owner);
        }
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

                    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

    public void setCamelContext(SpringCamelContext 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);
            }

            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

      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

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.