Class AutowiredMethodArgumentsResolver
java.lang.Object
org.springframework.beans.factory.aot.AutowiredMethodArgumentsResolver
Resolver used to support the autowiring of methods. Typically used in
 AOT-processed applications as a targeted alternative to the
 
AutowiredAnnotationBeanPostProcessor.
 When resolving arguments in a native image, the Method being used
 must be marked with an introspection hint
 so that field annotations can be read. Full invocation hints are only required if the
 resolveAndInvoke(RegisteredBean, Object) method of this class is
 being used (typically to support private methods).
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
- 
Method SummaryModifier and TypeMethodDescriptionCreate a newAutowiredMethodArgumentsResolverfor the specified method where injection is optional.forRequiredMethod(String methodName, Class<?>... parameterTypes) Create a newAutowiredMethodArgumentsResolverfor the specified method where injection is required.protected final voidregisterDependentBeans(ConfigurableBeanFactory beanFactory, String beanName, Set<String> autowiredBeanNames) resolve(RegisteredBean registeredBean) Resolve the method arguments for the specified registered bean.voidresolve(RegisteredBean registeredBean, ThrowingConsumer<AutowiredArguments> action) Resolve the method arguments for the specified registered bean and provide it to the given action.voidresolveAndInvoke(RegisteredBean registeredBean, Object instance) Resolve the method arguments for the specified registered bean and invoke the method using reflection.withShortcut(String... beanNames) Return a newAutowiredMethodArgumentsResolverinstance that uses direct bean name injection shortcuts for specific parameters.
- 
Method Details- 
forMethodpublic static AutowiredMethodArgumentsResolver forMethod(String methodName, Class<?>... parameterTypes) Create a newAutowiredMethodArgumentsResolverfor the specified method where injection is optional.- Parameters:
- methodName- the method name
- parameterTypes- the factory method parameter types
- Returns:
- a new AutowiredFieldValueResolverinstance
 
- 
forRequiredMethodpublic static AutowiredMethodArgumentsResolver forRequiredMethod(String methodName, Class<?>... parameterTypes) Create a newAutowiredMethodArgumentsResolverfor the specified method where injection is required.- Parameters:
- methodName- the method name
- parameterTypes- the factory method parameter types
- Returns:
- a new AutowiredFieldValueResolverinstance
 
- 
withShortcutReturn a newAutowiredMethodArgumentsResolverinstance that uses direct bean name injection shortcuts for specific parameters.- Parameters:
- beanNames- the bean names to use as shortcuts (aligned with the method parameters)
- Returns:
- a new AutowiredMethodArgumentsResolverinstance that uses the shortcuts
 
- 
resolveResolve the method arguments for the specified registered bean and provide it to the given action.- Parameters:
- registeredBean- the registered bean
- action- the action to execute with the resolved method arguments
 
- 
resolveResolve the method arguments for the specified registered bean.- Parameters:
- registeredBean- the registered bean
- Returns:
- the resolved method arguments
 
- 
resolveAndInvokeResolve the method arguments for the specified registered bean and invoke the method using reflection.- Parameters:
- registeredBean- the registered bean
- instance- the bean instance
 
- 
registerDependentBeansprotected final void registerDependentBeans(ConfigurableBeanFactory beanFactory, String beanName, Set<String> autowiredBeanNames) 
 
-