title: How to apply Spring Cloud Function's "Functional Bean Registration" for SpringBootApiGatewayRequestHandler
body: <p>I'm trying to deploy a AWS Lambda function, written using Spring Cloud Function 2.1.0, that receives an API Gateway Event. Therefore I setup a <code>ApplicationContextInitializer</code> as shown below as well as a <code>SpringBootApiGatewayRequestHandler</code>. Unfortunately I run into an Exception: <code>com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of</code>org.springframework.messaging.Message<code>(no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information</code>. </p>
  
  <p>I looked into spring-cloud-functions test cases and examples, but couldn't find an example for Functional Bean Registration with <code>Message</code> parameter/return value.</p>
  
  <pre class="lang-java prettyprint-override"><code>@SpringBootConfiguration
  public class ServiceConfiguration implements ApplicationContextInitializer&lt;GenericApplicationContext&gt; {
  
      public static void main(String[] args) {
          FunctionalSpringApplication.run(ServiceConfiguration.class, args);
      }
  
      public Function&lt;Message&lt;Pojo&gt;,Message&lt;Pojo&gt;&gt; transformMessage() {
          return request -&gt; new GenericMessage&lt;&gt;(new Pojo(request.getPayload().getValue().toUpperCase()));
      }
  
      @Override
      public void initialize(GenericApplicationContext applicationContext) {
          applicationContext
                  .registerBean("transformMessage", FunctionRegistration.class,
                          () -&gt; new FunctionRegistration&lt;&gt;(transformMessage())
                                  .type(FunctionType.from(Message.class).to(Message.class)));
      }
  
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class TransformMessageHandler extends SpringBootApiGatewayRequestHandler {
  }
  </code></pre>
  
  <p>Could someone point me out to a working example or give a hint on how to properly register it?</p>