Class DependencyInjectionPart

java.lang.Object
com.iohao.net.framework.core.DependencyInjectionPart

public final class DependencyInjectionPart extends Object
Singleton bridge for third-party dependency injection frameworks (e.g. Spring).

When injection is true, controller instances are obtained from the external container via the configured ActionFactoryBean instead of being instantiated directly by the framework.

Author:
渔民小镇
date:
2022-10-25
  • Field Details

    • injection

      public boolean injection
      true means integration with a third-party framework
    • annotationClass

      public Class<? extends Annotation> annotationClass
      Container Management Tag
    • actionFactoryBean

      public ActionFactoryBean<?> actionFactoryBean
      The currently used ActionFactoryBean
  • Method Details

    • deliveryContainer

      public boolean deliveryContainer(Class<?> controllerClazz)
      Check whether the given controller class is managed by the external container.
      Parameters:
      controllerClazz - the controller class to check
      Returns:
      true if the class carries the container annotation
    • getBean

      public <T> T getBean(ActionCommand actionCommand)
      Obtain a controller bean from the external container for the given action command.
      Type Parameters:
      T - the controller type
      Parameters:
      actionCommand - the action command whose controller is requested
      Returns:
      the controller instance
    • getBean

      public <T> T getBean(Class<?> actionControllerClazz)
      Obtain a controller bean from the external container by class.
      Type Parameters:
      T - the controller type
      Parameters:
      actionControllerClazz - the controller class
      Returns:
      the controller instance
    • me

      public static DependencyInjectionPart me()
      Return the singleton instance.
      Returns:
      the global DependencyInjectionPart