title: IllegalStateException: No function defined for Spring Cloud Function
body: <p>I have defined a function in my Spring Cloud Function project, but after executing function (<code>ScanQrCode</code>) as AS Lambda I get:</p>
  <pre><code>2020-07-13 10:19:04.592  INFO 1 --- [           main] lambdainternal.LambdaRTEntry             : Started LambdaRTEntry in 26.357 seconds (JVM running for 27.777)
  2020-07-13 10:19:04.653  INFO 1 --- [           main] o.s.c.f.c.c.SimpleFunctionRegistry       : Looking up function 'function' with acceptedOutputTypes: []
  2020-07-13 10:19:04.731  INFO 1 --- [           main] o.s.c.f.c.c.SimpleFunctionRegistry       : Looking up function 'consumer' with acceptedOutputTypes: []
  2020-07-13 10:19:04.734  INFO 1 --- [           main] o.s.c.f.c.c.SimpleFunctionRegistry       : Looking up function 'supplier' with acceptedOutputTypes: []
  2020-07-13 10:19:04.754  INFO 1 --- [           main] o.s.c.f.c.c.SimpleFunctionRegistry       : Looking up function '' with acceptedOutputTypes: []
  2020-07-13 10:19:04.811  INFO 1 --- [           main] o.s.c.f.c.c.SimpleFunctionRegistry       : Looking up function '' with acceptedOutputTypes: []
  2020-07-13 10:19:04.811  INFO 1 --- [           main] o.s.c.f.c.c.SimpleFunctionRegistry       : Looking up function '' with acceptedOutputTypes: []
  No function defined: java.lang.IllegalStateException
  java.lang.IllegalStateException: No function defined
      at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.apply(AbstractSpringFunctionAdapterInitializer.java:187)
      at org.springframework.cloud.function.adapter.aws.SpringBootRequestHandler.handleRequest(SpringBootRequestHandler.java:51)
  </code></pre>
  <p>The weired thing here is that I have commented out the <code>consume</code>, <code>supplier</code> and <code>function</code> functions...I don´t know why Spring or AWS Lambda considered them...</p>
  <p>Here are my classes:</p>
  <p><strong>Spring Boot App</strong></p>
  <pre><code>@SpringBootApplication
  public class FoodhatQrApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(FoodhatQrApplication.class, args);
      }
          
  //  @Bean
  //  public Function&lt;String, String&gt; function(){
  //      return input -&gt; input;
  //  }
  //  
  //  @Bean
  //  public Consumer&lt;String&gt; consume(){
  //      return input -&gt; System.out.println(&quot;Input: &quot; + input);
  //  }
  //
  //  @Bean
  //  public Supplier&lt;String&gt; supply(){
  //      return () -&gt; &quot;Hello World&quot;;
  //  }
  
  }
  </code></pre>
  <hr />
  <p><strong>Function class</strong></p>
  <pre><code>@Component
      public class ScanQrCode implements Function&lt;APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent&gt;{
      
          @Autowired
          private QrCodeRepository qrCodeRepository;
      
          @Override
          public APIGatewayProxyResponseEvent apply(APIGatewayProxyRequestEvent request) {
                APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent();
                response.setStatusCode(302);
                response.setHeaders(Collections.singletonMap(&quot;location&quot; , &quot;http://www.google.de&quot;));
                return response;
      
          }
      
      }
  </code></pre>
  <p>What am I missing?</p>