public class SpringBeanParameterResolverFactory extends Object implements ParameterResolverFactory, org.springframework.context.ApplicationContextAware
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.Constructor and Description |
---|
SpringBeanParameterResolverFactory()
Default 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.
|
Modifier and Type | Method and Description |
---|---|
ParameterResolver |
createInstance(Executable executable,
Parameter[] parameters,
int parameterIndex)
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) |
public SpringBeanParameterResolverFactory()
public SpringBeanParameterResolverFactory(org.springframework.context.ApplicationContext applicationContext)
applicationContext
- The application context providing access to beans that may be used as parameterspublic ParameterResolver createInstance(Executable executable, Parameter[] parameters, int parameterIndex)
ParameterResolverFactory
parameterType
for a given message.
If the ParameterResolverFactory cannot provide a suitable ParameterResolver, returns null
.
createInstance
in interface ParameterResolverFactory
executable
- The executable (constructor or method) to inspectparameters
- The parameters on the executable to inspectparameterIndex
- The index of the parameter to return a ParameterResolver fornull
if none is foundpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
Copyright © 2010–2019. All rights reserved.