Class SpringBeanParameterResolverFactory
java.lang.Object
org.axonframework.spring.config.annotation.SpringBeanParameterResolverFactory
- All Implemented Interfaces:
org.axonframework.messaging.annotation.ParameterResolverFactory,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class SpringBeanParameterResolverFactory
extends Object
implements org.axonframework.messaging.annotation.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 the desired one can be designated with a
Qualifier
annotation on the parameter. By absence of a Qualifier
annotation the bean marked as primary will be 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
ConstructorsConstructorDescriptionDefault constructor, which relies on Spring to inject the application context.SpringBeanParameterResolverFactory(org.springframework.context.ApplicationContext applicationContext) Convenience constructor to use when an instance is not managed by Spring, but an application context is available. -
Method Summary
Modifier and TypeMethodDescriptionorg.axonframework.messaging.annotation.ParameterResolver<?>createInstance(Executable executable, Parameter[] parameters, int parameterIndex) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Constructor Details
-
SpringBeanParameterResolverFactory
public SpringBeanParameterResolverFactory()Default constructor, which relies on Spring to inject the application context. -
SpringBeanParameterResolverFactory
public SpringBeanParameterResolverFactory(org.springframework.context.ApplicationContext applicationContext) Convenience constructor to use when an instance is not managed by Spring, but an application context is available.- Parameters:
applicationContext- The application context providing access to beans that may be used as parameters
-
-
Method Details
-
createInstance
public org.axonframework.messaging.annotation.ParameterResolver<?> createInstance(Executable executable, Parameter[] parameters, int parameterIndex) - Specified by:
createInstancein interfaceorg.axonframework.messaging.annotation.ParameterResolverFactory
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-