Lockless
Lockless

Reputation: 497

Azure web function bootstrap dependency injection java

I'm trying to add dependency injection to an Azure Web Function using Java. There are a good deal of examples to do so in C#. There is also a spring boot project that has got it to work. As far I can tell I should be able to add a bootstrap class with a main method to the local.settings.json file. Mine looks like this.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "java",
    "MAIN_CLASS":"com.example.Startup"
  }
}

That class has a main method but it fails to run when I run the azure functions local runner (mvn azure-functions:run). I want to ensure any time the app is run that the class loads and runs before invoking the web endpoint.

Upvotes: 0

Views: 328

Answers (1)

Jatin
Jatin

Reputation: 31734

The dependency injection support for Java doesn't exist.

There is an open ticket for this: https://github.com/Azure/azure-functions-java-worker/issues/324

Upvotes: 1

Related Questions