类org.springframework.beans.factory.FactoryBeanNotInitializedException源码实例Demo

下面列出了怎么用org.springframework.beans.factory.FactoryBeanNotInitializedException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: spring-analysis-note   文件: 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
 */
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;
}
 
@Override
@Nullable
public Object getObject() throws IllegalAccessException {
	if (this.fieldObject == null) {
		throw new FactoryBeanNotInitializedException();
	}
	ReflectionUtils.makeAccessible(this.fieldObject);
	if (this.targetObject != null) {
		// instance field
		return this.fieldObject.get(this.targetObject);
	}
	else {
		// class field
		return this.fieldObject.get(null);
	}
}
 
/**
 * Returns the same value each time if the singleton property is set
 * to "true", otherwise returns the value returned from invoking the
 * specified method on the fly.
 */
@Override
@Nullable
public Object getObject() throws Exception {
	if (this.singleton) {
		if (!this.initialized) {
			throw new FactoryBeanNotInitializedException();
		}
		// Singleton: return shared object.
		return this.singletonObject;
	}
	else {
		// Prototype: new object on each call.
		return invokeWithTargetException();
	}
}
 
源代码4 项目: java-technology-stack   文件: 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
 */
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;
}
 
@Override
@Nullable
public Object getObject() throws IllegalAccessException {
	if (this.fieldObject == null) {
		throw new FactoryBeanNotInitializedException();
	}
	ReflectionUtils.makeAccessible(this.fieldObject);
	if (this.targetObject != null) {
		// instance field
		return this.fieldObject.get(this.targetObject);
	}
	else {
		// class field
		return this.fieldObject.get(null);
	}
}
 
/**
 * Returns the same value each time if the singleton property is set
 * to "true", otherwise returns the value returned from invoking the
 * specified method on the fly.
 */
@Override
@Nullable
public Object getObject() throws Exception {
	if (this.singleton) {
		if (!this.initialized) {
			throw new FactoryBeanNotInitializedException();
		}
		// Singleton: return shared object.
		return this.singletonObject;
	}
	else {
		// Prototype: new object on each call.
		return invokeWithTargetException();
	}
}
 
源代码7 项目: lams   文件: 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
 */
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;
}
 
源代码8 项目: spring4-understanding   文件: 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
 */
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;
}
 
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
源代码11 项目: spring-analysis-note   文件: AbstractFactoryBean.java
/**
 * Determine an 'early singleton' instance, exposed in case of a
 * circular reference. Not called in a non-circular scenario.
 */
@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;
}
 
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
/**
 * Determine an 'early singleton' instance, exposed in case of a
 * circular reference. Not called in a non-circular scenario.
 */
@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;
}
 
源代码15 项目: lams   文件: AbstractFactoryBean.java
/**
 * Determine an 'eager singleton' instance, exposed in case of a
 * circular reference. Not called in a non-circular scenario.
 */
@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;
}
 
源代码16 项目: lams   文件: FieldRetrievingFactoryBean.java
@Override
public Object getObject() throws IllegalAccessException {
	if (this.fieldObject == null) {
		throw new FactoryBeanNotInitializedException();
	}
	ReflectionUtils.makeAccessible(this.fieldObject);
	if (this.targetObject != null) {
		// instance field
		return this.fieldObject.get(this.targetObject);
	}
	else {
		// class field
		return this.fieldObject.get(null);
	}
}
 
源代码17 项目: lams   文件: MethodInvokingFactoryBean.java
/**
 * Returns the same value each time if the singleton property is set
 * to "true", otherwise returns the value returned from invoking the
 * specified method on the fly.
 */
@Override
public Object getObject() throws Exception {
	if (this.singleton) {
		if (!this.initialized) {
			throw new FactoryBeanNotInitializedException();
		}
		// Singleton: return shared object.
		return this.singletonObject;
	}
	else {
		// Prototype: new object on each call.
		return invokeWithTargetException();
	}
}
 
源代码18 项目: lams   文件: ScopedProxyFactoryBean.java
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
源代码19 项目: lams   文件: AbstractSingletonProxyFactoryBean.java
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
源代码20 项目: blog_demos   文件: BeanReferenceFactoryBean.java
@Override
public Object getObject() throws BeansException {
	if (this.beanFactory == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.beanFactory.getBean(this.targetBeanName);
}
 
源代码21 项目: blog_demos   文件: BeanReferenceFactoryBean.java
@Override
public boolean isSingleton() {
	if (this.beanFactory == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.beanFactory.isSingleton(this.targetBeanName);
}
 
源代码22 项目: blog_demos   文件: BeanReferenceFactoryBean.java
@Override
public boolean isPrototype() {
	if (this.beanFactory == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.beanFactory.isPrototype(this.targetBeanName);
}
 
源代码23 项目: blog_demos   文件: AbstractFactoryBean.java
/**
 * Determine an 'eager singleton' instance, exposed in case of a
 * circular reference. Not called in a non-circular scenario.
 */
@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;
}
 
源代码24 项目: blog_demos   文件: FieldRetrievingFactoryBean.java
@Override
public Object getObject() throws IllegalAccessException {
	if (this.fieldObject == null) {
		throw new FactoryBeanNotInitializedException();
	}
	ReflectionUtils.makeAccessible(this.fieldObject);
	if (this.targetObject != null) {
		// instance field
		return this.fieldObject.get(this.targetObject);
	}
	else{
		// class field
		return this.fieldObject.get(null);
	}
}
 
源代码25 项目: blog_demos   文件: MethodInvokingFactoryBean.java
/**
 * Returns the same value each time if the singleton property is set
 * to "true", otherwise returns the value returned from invoking the
 * specified method on the fly.
 */
@Override
public Object getObject() throws Exception {
	if (this.singleton) {
		if (!this.initialized) {
			throw new FactoryBeanNotInitializedException();
		}
		// Singleton: return shared object.
		return this.singletonObject;
	}
	else {
		// Prototype: new object on each call.
		return doInvoke();
	}
}
 
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
@Override
public Object getObject() {
	if (this.proxy == null) {
		throw new FactoryBeanNotInitializedException();
	}
	return this.proxy;
}
 
/**
 * Determine an 'eager singleton' instance, exposed in case of a
 * circular reference. Not called in a non-circular scenario.
 */
@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;
}
 
@Override
public Object getObject() throws IllegalAccessException {
	if (this.fieldObject == null) {
		throw new FactoryBeanNotInitializedException();
	}
	ReflectionUtils.makeAccessible(this.fieldObject);
	if (this.targetObject != null) {
		// instance field
		return this.fieldObject.get(this.targetObject);
	}
	else{
		// class field
		return this.fieldObject.get(null);
	}
}
 
/**
 * Returns the same value each time if the singleton property is set
 * to "true", otherwise returns the value returned from invoking the
 * specified method on the fly.
 */
@Override
public Object getObject() throws Exception {
	if (this.singleton) {
		if (!this.initialized) {
			throw new FactoryBeanNotInitializedException();
		}
		// Singleton: return shared object.
		return this.singletonObject;
	}
	else {
		// Prototype: new object on each call.
		return invokeWithTargetException();
	}
}
 
 同包方法