Class AutowiredFieldValueResolver
java.lang.Object
org.springframework.beans.factory.aot.AutowiredFieldValueResolver
Resolver used to support the autowiring of fields. Typically used in
 AOT-processed applications as a targeted alternative to the
 
AutowiredAnnotationBeanPostProcessor.
 When resolving arguments in a native image, the Field being used must
 be marked with an introspection hint so
 that field annotations can be read. Full invocation hints are only required if the
 resolveAndSet(RegisteredBean, Object) method of this class is being
 used (typically to support private fields).
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
- 
Method SummaryModifier and TypeMethodDescriptionstatic AutowiredFieldValueResolverCreate a newAutowiredFieldValueResolverfor the specified field where injection is optional.static AutowiredFieldValueResolverforRequiredField(String fieldName) Create a newAutowiredFieldValueResolverfor the specified field where injection is required.protected final voidregisterDependentBeans(ConfigurableBeanFactory beanFactory, String beanName, Set<String> autowiredBeanNames) <T> Tresolve(RegisteredBean registeredBean) Resolve the field value for the specified registered bean.<T> Tresolve(RegisteredBean registeredBean, Class<T> requiredType) Resolve the field value for the specified registered bean.<T> voidresolve(RegisteredBean registeredBean, ThrowingConsumer<T> action) Resolve the field for the specified registered bean and provide it to the given action.voidresolveAndSet(RegisteredBean registeredBean, Object instance) Resolve the field value for the specified registered bean and set it using reflection.resolveObject(RegisteredBean registeredBean) Resolve the field value for the specified registered bean.withShortcut(String beanName) Return a newAutowiredFieldValueResolverinstance that uses a direct bean name injection shortcut.
- 
Method Details- 
forFieldCreate a newAutowiredFieldValueResolverfor the specified field where injection is optional.- Parameters:
- fieldName- the field name
- Returns:
- a new AutowiredFieldValueResolverinstance
 
- 
forRequiredFieldCreate a newAutowiredFieldValueResolverfor the specified field where injection is required.- Parameters:
- fieldName- the field name
- Returns:
- a new AutowiredFieldValueResolverinstance
 
- 
withShortcutReturn a newAutowiredFieldValueResolverinstance that uses a direct bean name injection shortcut.- Parameters:
- beanName- the bean name to use as a shortcut
- Returns:
- a new AutowiredFieldValueResolverinstance that uses the shortcuts
 
- 
resolveResolve the field 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 field value
 
- 
resolveResolve the field value for the specified registered bean.- Parameters:
- registeredBean- the registered bean
- requiredType- the required type
- Returns:
- the resolved field value
 
- 
resolveResolve the field value for the specified registered bean.- Parameters:
- registeredBean- the registered bean
- Returns:
- the resolved field value
 
- 
resolveObjectResolve the field value for the specified registered bean.- Parameters:
- registeredBean- the registered bean
- Returns:
- the resolved field value
 
- 
resolveAndSetResolve the field value for the specified registered bean and set it using reflection.- Parameters:
- registeredBean- the registered bean
- instance- the bean instance
 
- 
registerDependentBeansprotected final void registerDependentBeans(ConfigurableBeanFactory beanFactory, String beanName, Set<String> autowiredBeanNames) 
 
-