org.axonframework.contextsupport.spring
Class AutowiredDependencyFactoryBean

java.lang.Object
  extended by org.axonframework.contextsupport.spring.AutowiredDependencyFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class AutowiredDependencyFactoryBean
extends Object
implements org.springframework.beans.factory.FactoryBean, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean

Convenience factory bean that locates a bean of a number of given types. This factory is used to explicitly defined autowired dependencies on a per-property basis.

This factory does not create beans. It merely returns references to beans already existing.

Since:
1.0
Author:
Allard Buijze

Constructor Summary
AutowiredDependencyFactoryBean(Class<?>... beanTypes)
          Creates a factory bean that automatically resolved to a bean of one of the given beanTypes.
AutowiredDependencyFactoryBean(Object defaultBean, Class<?>... beanTypes)
          Creates a factory bean that automatically resolved to a bean of one of the given beanTypes, reverting to the given defaultBean if no candidates are found.
 
Method Summary
 void afterPropertiesSet()
           
 Object getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutowiredDependencyFactoryBean

public AutowiredDependencyFactoryBean(Class<?>... beanTypes)
Creates a factory bean that automatically resolved to a bean of one of the given beanTypes.

Parameters:
beanTypes - The types of bean to return a reference for

AutowiredDependencyFactoryBean

public AutowiredDependencyFactoryBean(Object defaultBean,
                                      Class<?>... beanTypes)
Creates a factory bean that automatically resolved to a bean of one of the given beanTypes, reverting to the given defaultBean if no candidates are found.

Parameters:
defaultBean - The bean to return when no autowire candidates are found
beanTypes - The types of bean to return a reference for
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getObject

public Object getObject()
                 throws Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception


Copyright © 2010-2016. All Rights Reserved.