Java 类org.springframework.beans.factory.FactoryBeanNotInitializedException 实例源码
项目:gemini.blueprint
文件:AbstractServiceImporterProxyFactoryBean.java
/**
* Returns a managed object for accessing OSGi service(s).
*
* @return managed OSGi service(s)
*/
public Object getObject() {
if (!initialized)
throw new FactoryBeanNotInitializedException();
if (proxy == null) {
synchronized (this) {
if (proxy == null) {
proxy = createProxy(false);
}
}
}
if (lazyProxy) {
synchronized (this) {
if (lazyProxy) {
getProxyInitializer().run();
lazyProxy = false;
}
}
}
return proxy;
}
项目: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;
}
项目: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;
}
项目:spring
文件: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;
}
项目:class-guard
文件: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;
}
项目:gen-sbconfigurator
文件:BeanCreator.java
@Override
public Object getObject() throws Exception {
if (clazz == null) {
throw new FactoryBeanNotInitializedException(
"The factory is not fully initialized yet, i.e. no class is defined by '"
+ beanClass + "'.");
}
if (singleton) {
if (created == null) {
created = createInstance();
}
return created;
} else {
return createInstance();
}
}
项目:lams
文件:BeanReferenceFactoryBean.java
@Override
public Object getObject() throws BeansException {
if (this.beanFactory == null) {
throw new FactoryBeanNotInitializedException();
}
return this.beanFactory.getBean(this.targetBeanName);
}
项目:lams
文件:BeanReferenceFactoryBean.java
@Override
public boolean isSingleton() {
if (this.beanFactory == null) {
throw new FactoryBeanNotInitializedException();
}
return this.beanFactory.isSingleton(this.targetBeanName);
}
项目:lams
文件:BeanReferenceFactoryBean.java
@Override
public boolean isPrototype() {
if (this.beanFactory == null) {
throw new FactoryBeanNotInitializedException();
}
return this.beanFactory.isPrototype(this.targetBeanName);
}
项目: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;
}
项目: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);
}
}
项目: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();
}
}
项目:lams
文件:ScopedProxyFactoryBean.java
@Override
public Object getObject() {
if (this.proxy == null) {
throw new FactoryBeanNotInitializedException();
}
return this.proxy;
}
项目:lams
文件:AbstractSingletonProxyFactoryBean.java
@Override
public Object getObject() {
if (this.proxy == null) {
throw new FactoryBeanNotInitializedException();
}
return this.proxy;
}
项目:mxisd
文件:OrmLiteSqliteStorageBeanFactory.java
@Override
public IStorage getObject() throws Exception {
if (storage == null) {
throw new FactoryBeanNotInitializedException();
}
return storage;
}
项目:spring4-understanding
文件:ScopedProxyFactoryBean.java
@Override
public Object getObject() {
if (this.proxy == null) {
throw new FactoryBeanNotInitializedException();
}
return this.proxy;
}
项目:spring4-understanding
文件:AbstractSingletonProxyFactoryBean.java
@Override
public Object getObject() {
if (this.proxy == null) {
throw new FactoryBeanNotInitializedException();
}
return this.proxy;
}
项目:spring4-understanding
文件: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;
}
项目:spring4-understanding
文件: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);
}
}
项目:spring4-understanding
文件: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();
}
}
项目:spring
文件: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;
}
项目:spring
文件: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);
}
}
项目:spring
文件: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();
}
}
项目:spring
文件:ScopedProxyFactoryBean.java
@Override
public Object getObject() {
if (this.proxy == null) {
throw new FactoryBeanNotInitializedException();
}
return this.proxy;
}
项目:spring
文件:AbstractSingletonProxyFactoryBean.java
@Override
public Object getObject() {
if (this.proxy == null) {
throw new FactoryBeanNotInitializedException();
}
return this.proxy;
}
项目:ephesoft
文件:EphesoftContext.java
/**
* To get single bean of the specified type.
* @param type Class<T>
* @param <T>
* @return <T>
*/
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);
}
项目:kc-rice
文件:LazyServiceFactoryBean.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.");
}
}
this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(),
new LazyInvocationHandler());
}
项目:kc-rice
文件: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.");
}
}
this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(),
new LazyInvocationHandler());
}
项目:perecoder
文件:IndexRebuildTaskPerformer.java
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (beanFactory instanceof ListableBeanFactory) {
this.beanFactory = (ListableBeanFactory) beanFactory;
} else {
throw new FactoryBeanNotInitializedException(String.format("BeanFactory must be instance of '%s'", ListableBeanFactory.class.getSimpleName()));
}
}
项目:class-guard
文件: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;
}
项目:class-guard
文件:FieldRetrievingFactoryBean.java
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);
}
}
项目:class-guard
文件: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.
*/
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();
}
}
项目:rice
文件:LazyServiceFactoryBean.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.");
}
}
this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(),
new LazyInvocationHandler());
}
项目:rice
文件: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.");
}
}
this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(),
new LazyInvocationHandler());
}
项目:spring-osgi
文件:AbstractServiceImporterProxyFactoryBean.java
/**
* Returns a managed object for accessing OSGi service(s).
*
* @return managed OSGi service(s)
*/
public Object getObject() {
if (!initialized)
throw new FactoryBeanNotInitializedException();
if (proxy == null) {
proxy = createProxy();
}
return proxy;
}
项目:SimpleJavaWS
文件:MemcachedFactory.java
@Override
public Object getObject() throws IOException {
String[] urls = StringUtils.split(cacheLocations, ", ");
List<InetSocketAddress> addresses = new ArrayList<InetSocketAddress>();
for (String url : urls) {
int colonIndex = url.indexOf(":");
String host = url.substring(0, colonIndex);
int port = NumberUtils.toInt(url.substring(colonIndex + 1, url.length()));
if(port==0) {
throw new FactoryBeanNotInitializedException("invalid port: cacheLocations=" + cacheLocations);
}
InetSocketAddress address = new InetSocketAddress(host, port);
addresses.add(address);
}
long timeout = Math.max(readTimeout, writeTimeout);
//TODO make all the below properties configurable via properties file
ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder()
.setOpTimeout(timeout)
.setDaemon(true)
.setProtocol(Protocol.BINARY)
.setHashAlg(DefaultHashAlgorithm.KETAMA_HASH)
.setFailureMode(FailureMode.Retry)
.setInitialObservers(Collections.singleton((ConnectionObserver) new MemcachedAlerter()));
if(transcoder!=null) {
builder.setTranscoder(transcoder);
}
ConnectionFactory connectionFactory = builder.build();
return new MemcachedClient(connectionFactory, addresses);
}
项目:SimpleJavaWS
文件:RedisFactory.java
@Override
public Object getObject() {
String[] urls = StringUtils.split(cacheLocations, ",");
String[] weights = StringUtils.split(weightOfHosts, ",");
if (urls.length < weights.length) {
throw new FactoryBeanNotInitializedException("invalid number of weights: weightOfHosts= " + weightOfHosts + " (Number of weights > Number of urls)");
}
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
long timeout = Math.max(readTimeout, writeTimeout);
for ( int i = 0; i < urls.length; i++) {
int colonIndex = urls[i].indexOf(":");
String host = urls[i].substring(0, colonIndex);
int port = NumberUtils.toInt(urls[i].substring(colonIndex + 1, urls[i].length()));
if(port==0) {
throw new FactoryBeanNotInitializedException("invalid port: cacheLocations=" + cacheLocations);
}
if( weights[i] == null) {
weights[i] = "1";
}
int weight = Integer.parseInt(weights[i]);
JedisShardInfo jedisShardInfo = new JedisShardInfo(host, port, (int) timeout,weight);
shards.add(jedisShardInfo);
}
MurmurHash murmurHash = new MurmurHash();
ShardedJedis jedisClient = new ShardedJedis(shards,murmurHash);
return jedisClient;
}
项目:kuali_rice
文件:LazyServiceFactoryBean.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.");
}
}
this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(),
new LazyInvocationHandler());
}
项目:kuali_rice
文件: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.");
}
}
this.proxyObject = Proxy.newProxyInstance(getClass().getClassLoader(), getProxyInterfaces(),
new LazyInvocationHandler());
}
项目:spring-ldap
文件:OdmManagerImplFactoryBean.java
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);
}