Class InjectionMetadata
java.lang.Object
org.springframework.beans.factory.annotation.InjectionMetadata
Internal class for managing injection metadata.
 
Not intended for direct use in applications.
Used by AutowiredAnnotationBeanPostProcessor,
 CommonAnnotationBeanPostProcessor, and
 PersistenceAnnotationBeanPostProcessor.
- Since:
- 2.5
- Author:
- Juergen Hoeller
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA single injected element.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final InjectionMetadataAn emptyInjectionMetadatainstance with no-op callbacks.
- 
Constructor SummaryConstructorsConstructorDescriptionInjectionMetadata(Class<?> targetClass, Collection<InjectionMetadata.InjectedElement> elements) Create a newInjectionMetadata instance.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcheckConfigMembers(RootBeanDefinition beanDefinition) voidclear(PropertyValues pvs) Clear property skipping for the contained elements.static InjectionMetadataforElements(Collection<InjectionMetadata.InjectedElement> elements, Class<?> clazz) Return anInjectionMetadatainstance, possibly for empty elements.Return theelementsto inject.Return theelementsto inject based on the specifiedPropertyValues.voidinject(Object target, String beanName, PropertyValues pvs) protected booleanneedsRefresh(Class<?> clazz) Determine whether this metadata instance needs to be refreshed.static booleanneedsRefresh(InjectionMetadata metadata, Class<?> clazz) Check whether the given injection metadata needs to be refreshed.
- 
Field Details- 
EMPTYAn emptyInjectionMetadatainstance with no-op callbacks.- Since:
- 5.2
 
 
- 
- 
Constructor Details- 
InjectionMetadatapublic InjectionMetadata(Class<?> targetClass, Collection<InjectionMetadata.InjectedElement> elements) Create a newInjectionMetadata instance.Preferably use forElements(java.util.Collection<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement>, java.lang.Class<?>)for reusing theEMPTYinstance in case of no elements.- Parameters:
- targetClass- the target class
- elements- the associated elements to inject
- See Also:
 
 
- 
- 
Method Details- 
getInjectedElementsReturn theelementsto inject.- Returns:
- the elements to inject
 
- 
getInjectedElementspublic Collection<InjectionMetadata.InjectedElement> getInjectedElements(@Nullable PropertyValues pvs) Return theelementsto inject based on the specifiedPropertyValues. If a property is already defined for anInjectionMetadata.InjectedElement, it is excluded.- Parameters:
- pvs- the property values to consider
- Returns:
- the elements to inject
- Since:
- 6.0.10
 
- 
needsRefreshDetermine whether this metadata instance needs to be refreshed.- Parameters:
- clazz- the current target class
- Returns:
- trueindicating a refresh,- falseotherwise
- Since:
- 5.2.4
 
- 
checkConfigMembers
- 
injectpublic void inject(Object target, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable - Throws:
- Throwable
 
- 
clearClear property skipping for the contained elements.- Since:
- 3.2.13
 
- 
forElementspublic static InjectionMetadata forElements(Collection<InjectionMetadata.InjectedElement> elements, Class<?> clazz) Return anInjectionMetadatainstance, possibly for empty elements.- Parameters:
- elements- the elements to inject (possibly empty)
- clazz- the target class
- Returns:
- a new InjectionMetadata(Class, Collection)instance
- Since:
- 5.2
 
- 
needsRefresh@Contract("null, _ -> true") public static boolean needsRefresh(@Nullable InjectionMetadata metadata, Class<?> clazz) Check whether the given injection metadata needs to be refreshed.- Parameters:
- metadata- the existing metadata instance
- clazz- the current target class
- Returns:
- trueindicating a refresh,- falseotherwise
- See Also:
 
 
-