Class FieldBeanInjection
java.lang.Object
com.bobocode.bring.core.context.impl.FieldBeanInjection
Responsible for injecting dependencies into fields of a bean using annotations like @Autowired or @Value.
Handles field-based dependency injection for annotated fields within a class.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AnnotationBringBeanRegistryprivate final ClassPathScannerFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidinjectDependencyViaField(Field field, Object bean) Injects a dependency into a specific field of the provided bean instance.voidinjectViaFields(Class<?> clazz, Object bean) Injects dependencies into fields of the provided class instance based on annotations.private static ObjectsetFieldDependency(Field field, Object bean, FieldValueTypeInjector valueType, List<Class<? extends Annotation>> createdBeanAnnotations) Sets the value of a field in the provided bean instance with the resolved dependency.
-
Field Details
-
beanRegistry
-
classPathScannerFactory
-
-
Constructor Details
-
FieldBeanInjection
public FieldBeanInjection()
-
-
Method Details
-
injectViaFields
Injects dependencies into fields of the provided class instance based on annotations.- Parameters:
clazz- The class whose fields are to be injected with dependencies.bean- The instance of the class whose fields are being injected.
-
injectDependencyViaField
Injects a dependency into a specific field of the provided bean instance.- Parameters:
field- The field to be injected with a dependency.bean- The instance of the class whose field is being injected.
-
setFieldDependency
private static Object setFieldDependency(Field field, Object bean, FieldValueTypeInjector valueType, List<Class<? extends Annotation>> createdBeanAnnotations) Sets the value of a field in the provided bean instance with the resolved dependency.- Parameters:
field- The field to be set with the resolved dependency.bean- The instance of the class whose field is being set.valueType- The ValueTypeInjector responsible for setting the field value.createdBeanAnnotations- List of created bean annotations used for dependency resolution.- Returns:
- The resolved dependency object.
-