Example usage for org.springframework.beans.factory FactoryBeanNotInitializedException FactoryBeanNotInitializedException

List of usage examples for org.springframework.beans.factory FactoryBeanNotInitializedException FactoryBeanNotInitializedException

Introduction

In this page you can find the example usage for org.springframework.beans.factory FactoryBeanNotInitializedException FactoryBeanNotInitializedException.

Prototype

public FactoryBeanNotInitializedException(String msg) 

Source Link

Document

Create a new FactoryBeanNotInitializedException with the given message.

Usage

From source file:org.springextensions.neodatis.ODBFactoryBean.java

@Override
public ODB getObject() throws Exception {
    if (odb == null) {
        throw new FactoryBeanNotInitializedException("ODB not opened.");
    }/*  w ww. j a  v a  2  s .  com*/
    return odb;
}

From source file:org.springextensions.db4o.ObjectContainerFactoryBean.java

/**
 * @see org.springframework.beans.factory.FactoryBean#getObject()
 *//* w ww.j av a 2s.  c om*/
public ObjectContainer getObject() throws Exception {
    if (container == null) {
        throw new FactoryBeanNotInitializedException("object container not opened");
    }
    return container;
}

From source file:com.ephesoft.dcma.batch.service.EphesoftContext.java

/**
 * Returns the instance of type passed as parameter.
 * /*  w  w w .  ja  v a 2s .c  o m*/
 * @param <T> type of instance.
 * @param type instance type class.
 * @return instance of type required.
 */
public static <T> T get(final Class<T> type) {
    if (applicationContext == null) {
        LOGGER.error("Ephesoft application Context yet not initialized.");
        throw new FactoryBeanNotInitializedException("Ephesoft application Context yet not initialized.");
    }
    return ApplicationContextUtil.getSingleBeanOfType(applicationContext, type);
}

From source file:com.ephesoft.dcma.batch.service.EphesoftContext.java

/**
 * Returns the instance of type and name passes as a parameter.
 * /*from  w w w . java 2s  . c o  m*/
 * @param <T> type of instance.
 * @param type instance type class.
 * @param name instance type name.
 * @return instance of type required.
 */
public static <T> T get(Class<T> type, String name) {
    if (applicationContext == null) {
        LOGGER.error("Ephesoft application Context yet not initialized.");
        throw new FactoryBeanNotInitializedException("Ephesoft application Context yet not initialized.");
    }
    return ApplicationContextUtil.getBeanFromContext(applicationContext, name, type);
}

From source file:org.kuali.rice.core.api.resourceloader.LazyResourceFactoryBean.java

public void afterPropertiesSet() throws Exception {
    if (ArrayUtils.isEmpty(getProxyInterfaces())) {
        setProxyInterfaces(detectProxyInterfaces());
        if (ArrayUtils.isEmpty(getProxyInterfaces())) {
            throw new FactoryBeanNotInitializedException("Failed to initialize factory bean because "
                    + "proxyInterfaces were not injected or could not be derived from object type.");
        }//from  w  w w. j  a  v a  2  s  . c o m
    }
    this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(),
            new LazyInvocationHandler());
}

From source file:org.springframework.aop.framework.ProxyFactoryBean.java

/**
 * Return the singleton instance of this class's proxy object,
 * lazily creating it if it hasn't been created already.
 * @return the shared singleton proxy//from ww  w.j  a  va  2  s  . c  o m
 */
private synchronized Object getSingletonInstance() {
    if (this.singletonInstance == null) {
        this.targetSource = freshTargetSource();
        if (this.autodetectInterfaces && getProxiedInterfaces().length == 0 && !isProxyTargetClass()) {
            // Rely on AOP infrastructure to tell us what interfaces to proxy.
            Class<?> targetClass = getTargetClass();
            if (targetClass == null) {
                throw new FactoryBeanNotInitializedException("Cannot determine target class for proxy");
            }
            setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, this.proxyClassLoader));
        }
        // Initialize the shared singleton instance.
        super.setFrozen(this.freezeProxy);
        this.singletonInstance = getProxy(createAopProxy());
    }
    return this.singletonInstance;
}

From source file:org.springframework.beans.factory.config.AbstractFactoryBean.java

/**
 * Determine an 'eager singleton' instance, exposed in case of a
 * circular reference. Not called in a non-circular scenario.
 *///ww w . j av  a2 s. c  o  m
@SuppressWarnings("unchecked")
private T getEarlySingletonInstance() throws Exception {
    Class<?>[] ifcs = getEarlySingletonInterfaces();
    if (ifcs == null) {
        throw new FactoryBeanNotInitializedException(
                getClass().getName() + " does not support circular references");
    }
    if (this.earlySingletonInstance == null) {
        this.earlySingletonInstance = (T) Proxy.newProxyInstance(this.beanClassLoader, ifcs,
                new EarlySingletonInvocationHandler());
    }
    return this.earlySingletonInstance;
}