Class AzureFunctionInstanceInjector

java.lang.Object
org.springframework.cloud.function.adapter.azure.AzureFunctionInstanceInjector
All Implemented Interfaces:
com.microsoft.azure.functions.spi.inject.FunctionInstanceInjector

public class AzureFunctionInstanceInjector extends Object implements com.microsoft.azure.functions.spi.inject.FunctionInstanceInjector
The instance factory used by the Spring framework to initialize Azure function instance. It is waived with the Azure Java Worker through the META-INFO/services/com.microsoft.azure.functions.spi.inject.FunctionInstanceInjector service hook. The Azure Java Worker delegates scans the classpath for service definition and delegates the function class creation to this instance factory.
Since:
3.2.9
Author:
Christian Tzolov
  • Constructor Details

    • AzureFunctionInstanceInjector

      public AzureFunctionInstanceInjector()
  • Method Details

    • getInstance

      public <T> T getInstance(Class<T> functionClass) throws Exception
      This method is called by the Azure Java Worker on every function invocation. The Worker sends in the classes annotated with @FunctionName annotations and allows the Spring framework to initialize the function instance as a Spring Bean and return the instance. Then the Worker uses the created instance to invoke the function.
      Specified by:
      getInstance in interface com.microsoft.azure.functions.spi.inject.FunctionInstanceInjector
      Type Parameters:
      T - customer Azure functions class type
      Parameters:
      functionClass - the class that contains customer Azure functions (e.g. @FunctionName annotated )
      Returns:
      the instance that will be invoked on by azure functions java worker
      Throws:
      Exception - any exception that is thrown by the Spring framework during instance creation