Interface BringBeanFactory

All Known Implementing Classes:
AnnotationBringBeanRegistry, BringApplicationContext, DefaultBringBeanFactory

public interface BringBeanFactory
An interface representing a simplified Bean Factory, allowing retrieval of beans by type or name. Implementations of this interface provide methods to retrieve beans based on specified criteria.
Since:
1.0
Author:
Blyzhnytsia Team
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the container.This method is typically called when the container is being shut down to allow beans to perform necessary cleanup operations or release resources before being destroyed.
    <T> Map<String,T>
    Retrieve a map containing all registered beans, where the key is the bean name and the value is the bean instance.
    <T> T
    getBean(Class<T> type)
    Retrieve a bean of the specified type.
    <T> T
    getBean(Class<T> type, String name)
    Retrieve a bean of the specified type and name.
    <T> Map<String,T>
    getBeans(Class<T> type)
    Retrieve a map of beans of the specified type, where the key is the bean name and the value is the bean instance.
  • Method Details

    • getBean

      <T> T getBean(Class<T> type)
      Retrieve a bean of the specified type.
      Type Parameters:
      T - The type of the bean.
      Parameters:
      type - The class/type of the bean to retrieve.
      Returns:
      An instance of the requested bean or throw NoSuchBeanException
    • getBean

      <T> T getBean(Class<T> type, String name)
      Retrieve a bean of the specified type and name.
      Type Parameters:
      T - The type of the bean.
      Parameters:
      type - The class/type of the bean to retrieve.
      name - The name of the bean to retrieve.
      Returns:
      An instance of the requested bean or throw NoSuchBeanException
    • getBeans

      <T> Map<String,T> getBeans(Class<T> type)
      Retrieve a map of beans of the specified type, where the key is the bean name and the value is the bean instance.
      Type Parameters:
      T - The type of the beans.
      Parameters:
      type - The class/type of the beans to retrieve.
      Returns:
      A map containing bean names as keys and corresponding bean instances as values or throw NoSuchBeanException
    • getAllBeans

      <T> Map<String,T> getAllBeans()
      Retrieve a map containing all registered beans, where the key is the bean name and the value is the bean instance.
      Type Parameters:
      T - The type of the beans.
      Returns:
      A map containing all registered bean names as keys and corresponding bean instances as values.
    • close

      void close()
      Closes the container.This method is typically called when the container is being shut down to allow beans to perform necessary cleanup operations or release resources before being destroyed.