org.springframework.beans.factory.FactoryBeanNotInitializedException Java Examples
The following examples show how to use
org.springframework.beans.factory.FactoryBeanNotInitializedException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProxyFactoryBean.java From spring-analysis-note with MIT License | 6 votes |
/** * 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; }
Example #2
Source File: FieldRetrievingFactoryBean.java From spring-analysis-note with MIT License | 6 votes |
@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); } }
Example #3
Source File: MethodInvokingFactoryBean.java From spring-analysis-note with MIT License | 6 votes |
/** * 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(); } }
Example #4
Source File: ProxyFactoryBean.java From lams with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #5
Source File: ProxyFactoryBean.java From java-technology-stack with MIT License | 6 votes |
/** * 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; }
Example #6
Source File: FieldRetrievingFactoryBean.java From java-technology-stack with MIT License | 6 votes |
@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); } }
Example #7
Source File: MethodInvokingFactoryBean.java From java-technology-stack with MIT License | 6 votes |
/** * 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(); } }
Example #8
Source File: ProxyFactoryBean.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * 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; }
Example #9
Source File: AbstractFactoryBean.java From blog_demos with Apache License 2.0 | 5 votes |
/** * 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; }
Example #10
Source File: ConverterManagerFactoryBean.java From spring-ldap with Apache License 2.0 | 5 votes |
/** * Creates a ConverterManagerImpl populating it with Converter instances from the converterConfigList property. * * @return The newly created {@link org.springframework.ldap.odm.typeconversion.ConverterManager}. * @throws ClassNotFoundException Thrown if any of the classes to be converted to or from cannot be found. * * @see org.springframework.beans.factory.FactoryBean#getObject() */ public Object getObject() throws Exception { if (converterConfigList==null) { throw new FactoryBeanNotInitializedException("converterConfigList has not been set"); } ConverterManagerImpl result = new ConverterManagerImpl(); for (ConverterConfig converterConfig : converterConfigList) { if (converterConfig.fromClasses==null || converterConfig.toClasses==null || converterConfig.converter==null) { throw new FactoryBeanNotInitializedException( String.format("All of fromClasses, toClasses and converter must be specified in bean %1$s", converterConfig.toString())); } for (Class<?> fromClass : converterConfig.fromClasses) { for (Class<?> toClass : converterConfig.toClasses) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Adding converter from %1$s to %2$s", fromClass, toClass)); } result.addConverter(fromClass, converterConfig.syntax, toClass, converterConfig.converter); } } } return result; }
Example #11
Source File: FieldRetrievingFactoryBean.java From blog_demos with Apache License 2.0 | 5 votes |
@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); } }
Example #12
Source File: MethodInvokingFactoryBean.java From blog_demos with Apache License 2.0 | 5 votes |
/** * 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(); } }
Example #13
Source File: ScopedProxyFactoryBean.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public Object getObject() { if (this.proxy == null) { throw new FactoryBeanNotInitializedException(); } return this.proxy; }
Example #14
Source File: AbstractSingletonProxyFactoryBean.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public Object getObject() { if (this.proxy == null) { throw new FactoryBeanNotInitializedException(); } return this.proxy; }
Example #15
Source File: AbstractFactoryBean.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * 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; }
Example #16
Source File: FieldRetrievingFactoryBean.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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); } }
Example #17
Source File: MethodInvokingFactoryBean.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * 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(); } }
Example #18
Source File: LazyServiceFactoryBean.java From rice with Educational Community License v2.0 | 5 votes |
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."); } } this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(), new LazyInvocationHandler()); }
Example #19
Source File: LazyResourceFactoryBean.java From rice with Educational Community License v2.0 | 5 votes |
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."); } } this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(), new LazyInvocationHandler()); }
Example #20
Source File: OdmManagerImplFactoryBean.java From spring-ldap with Apache License 2.0 | 5 votes |
public Object getObject() throws Exception { if (ldapOperations==null) { throw new FactoryBeanNotInitializedException("contextSource ldapOperations property has not been set"); } if (managedClasses==null) { throw new FactoryBeanNotInitializedException("managedClasses property has not been set"); } if (converterManager==null) { throw new FactoryBeanNotInitializedException("converterManager property has not been set"); } return new OdmManagerImpl(converterManager, ldapOperations, managedClasses); }
Example #21
Source File: ScopedProxyFactoryBean.java From spring-analysis-note with MIT License | 5 votes |
@Override public Object getObject() { if (this.proxy == null) { throw new FactoryBeanNotInitializedException(); } return this.proxy; }
Example #22
Source File: BeanReferenceFactoryBean.java From blog_demos with Apache License 2.0 | 5 votes |
@Override public boolean isPrototype() { if (this.beanFactory == null) { throw new FactoryBeanNotInitializedException(); } return this.beanFactory.isPrototype(this.targetBeanName); }
Example #23
Source File: BeanReferenceFactoryBean.java From blog_demos with Apache License 2.0 | 5 votes |
@Override public boolean isSingleton() { if (this.beanFactory == null) { throw new FactoryBeanNotInitializedException(); } return this.beanFactory.isSingleton(this.targetBeanName); }
Example #24
Source File: BeanReferenceFactoryBean.java From blog_demos with Apache License 2.0 | 5 votes |
@Override public Object getObject() throws BeansException { if (this.beanFactory == null) { throw new FactoryBeanNotInitializedException(); } return this.beanFactory.getBean(this.targetBeanName); }
Example #25
Source File: AbstractSingletonProxyFactoryBean.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object getObject() { if (this.proxy == null) { throw new FactoryBeanNotInitializedException(); } return this.proxy; }
Example #26
Source File: ScopedProxyFactoryBean.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object getObject() { if (this.proxy == null) { throw new FactoryBeanNotInitializedException(); } return this.proxy; }
Example #27
Source File: MethodInvokingFactoryBean.java From lams with GNU General Public License v2.0 | 5 votes |
/** * 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(); } }
Example #28
Source File: FieldRetrievingFactoryBean.java From lams with GNU General Public License v2.0 | 5 votes |
@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); } }
Example #29
Source File: AbstractFactoryBean.java From lams with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #30
Source File: AbstractFactoryBean.java From java-technology-stack with MIT License | 5 votes |
/** * 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; }