org.axonframework.common.annotation
Class SpringBeanParameterResolverFactory

java.lang.Object
  extended by org.axonframework.common.annotation.SpringBeanParameterResolverFactory
All Implemented Interfaces:
ParameterResolverFactory, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class SpringBeanParameterResolverFactory
extends Object
implements ParameterResolverFactory, org.springframework.context.ApplicationContextAware

ParameterResolverFactory implementation that resolves parameters in the Spring Application Context. A parameter can be resolved as a Spring bean if there is exactly one bean assignable to the parameter type. If multiple beans are available and one is marked as primary, that bean is chosen. Note that when multiple beans are marked as primary, either one can be selected as parameter value.

Since:
2.1
Author:
Allard Buijze

Constructor Summary
SpringBeanParameterResolverFactory()
           
 
Method Summary
 ParameterResolver createInstance(Annotation[] memberAnnotations, Class<?> parameterType, Annotation[] parameterAnnotations)
          If available, creates a ParameterResolver instance that can provide a parameter of type parameterType for a given message.
 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

SpringBeanParameterResolverFactory

public SpringBeanParameterResolverFactory()
Method Detail

createInstance

public ParameterResolver createInstance(Annotation[] memberAnnotations,
                                        Class<?> parameterType,
                                        Annotation[] parameterAnnotations)
Description copied from interface: ParameterResolverFactory
If available, creates a ParameterResolver instance that can provide a parameter of type parameterType for a given message.

If the ParameterResolverFactory cannot provide a suitable ParameterResolver, returns null.

Specified by:
createInstance in interface ParameterResolverFactory
Parameters:
memberAnnotations - annotations placed on the member (e.g. method)
parameterType - the parameter type to find a resolver for
parameterAnnotations - annotations placed on the parameter
Returns:
a suitable ParameterResolver, or null if none is found

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


Copyright © 2010-2016. All Rights Reserved.