Class BeanCreator

java.lang.Object
com.bobocode.bring.core.context.impl.BeanCreator

public class BeanCreator extends Object
Responsible for creating beans and injecting dependencies into these beans based on provided definitions.
Since:
1.0
Author:
Blyzhnytsia Team
  • Field Details

  • Constructor Details

    • BeanCreator

      public BeanCreator(AnnotationBringBeanRegistry beanRegistry, ClassPathScannerFactory classPathScannerFactory)
      Constructs a BeanCreator.
      Parameters:
      beanRegistry - The registry storing beans and their definitions.
      classPathScannerFactory - The factory for creating class path scanners.
  • Method Details

    • create

      public Object create(Class<?> clazz, String beanName, BeanDefinition beanDefinition)
      Creates a bean of the specified class and injects dependencies into it.
      Parameters:
      clazz - The class of the bean to be created.
      beanName - The name of the bean being created.
      beanDefinition - The definition of the bean being created.
      Returns:
      The created bean object.
    • registerConfigurationBean

      public Object registerConfigurationBean(String beanName, BeanDefinition beanDefinition)
      Registers a configuration bean in the context based on the provided bean name and definition. Resolves dependencies and instantiates the configuration bean within the context.
      Parameters:
      beanName - The name of the configuration bean to be registered.
      beanDefinition - The definition of the configuration bean.
      Returns:
      The registered configuration bean.
    • injectDependencies

      private void injectDependencies(Class<?> clazz, Object bean)
      Injects dependencies into the passed bean based on its class.
      Parameters:
      clazz - The class of the bean.
      bean - The bean.