title: How to code Spring Cloud Function in Azure with multiple endpoints?
body: <p>I am trying to create 2 Azure Functions with Spring Cloud but I can't make it work.</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class FirstFunction extends AzureSpringBootRequestHandler&lt;Optional&lt;Void&gt;, String&gt;
  {
    @FunctionName("firstFunction")
    public void run(
        @HttpTrigger(name = "req", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.FUNCTION) HttpRequestMessage&lt;Optional&lt;String&gt;&gt; request,
        final ExecutionContext context)
    {
      handleRequest(Optional.empty(), context);
    }
  
    @Bean
    @Lazy
    Function&lt;Optional&lt;Void&gt;, String&gt; firstFunction()
    {
      return context -&gt;
      {
        // do firstFunction stuff;
      };
    }
  }
  
  
  
  @Configuration
  public class SecondFunction extends AzureSpringBootRequestHandler&lt;Optional&lt;Void&gt;, String&gt;
  {
    @FunctionName("secondFunction")
    public void run(
        @HttpTrigger(name = "req", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.FUNCTION) HttpRequestMessage&lt;Optional&lt;String&gt;&gt; request,
        final ExecutionContext context)
    {
      handleRequest(Optional.empty(), context);
    }
  
    @Bean
    @Lazy
    Function&lt;Optional&lt;Void&gt;, String&gt; secondFunction()
    {
      return context -&gt;
      {
        // do secondFunction stuff;
      };
    }
  }
  
  
  
  @SpringBootApplication
  public class Application
  {
    public static void main(final String[] args)
    {
      SpringApplication.run(Application.class, args);
    }
  }
  </code></pre>
  
  <p>Using the above code with the dependency on <code>spring-cloud-function-dependencies 2.0.1.RELEASE</code>, it always hits the <code>firstFunction Bean</code> when calling both the <code>firstFunction</code> and <code>secondFunction</code> endpoints.</p>
  
  <p>After doing some googling, I found this <a href="https://stackoverflow.com/questions/55220143/how-to-expose-multiple-function-endpoints-with-spring-cloud-function">SO answer</a> that suggests to move to <code>2.1</code>.</p>
  
  <p>However when I tried changing to <code>2.1.1.RELEASE</code>, I am getting an exception where it is failing to find a main class:</p>
  
  <pre><code>System.Private.CoreLib: Exception while executing function: Functions.extractContent. System.Private.CoreLib: Result: Failure
  Exception: IllegalArgumentException: Failed to locate main class
  Stack: java.lang.IllegalStateException: Failed to discover main class. An attempt was made to discover main class as 'MAIN_CLASS' environment variable, system property as well as entry
  in META-INF/MANIFEST.MF (in that order).
  </code></pre>
  
  <p>Need some help on what I am doing wrong.</p>