Stack Exchange
running graals native spring cloud function example
I am trying to run the aws function sample in spring-graals, the 'java' version works fine but when I test the 'native' version, I see the following error in the console.
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : org.springframework.cloud.function.adapter.aws.CustomRuntimeInitializer
    at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:445)
    at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:427)
    at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:420)
    at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:272)
    at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:253)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at com.example.demo.serverless.ServerlessApplication.main(ServerlessApplication.java:22)
Caused by: java.lang.NoSuchMethodException: org.springframework.cloud.function.adapter.aws.CustomRuntimeInitializer.<init>()
    at java.lang.Class.getConstructor0(DynamicHub.java:3082)
    at java.lang.Class.getDeclaredConstructor(DynamicHub.java:2178)
    at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:440)
    ... 7 more

The sample logs the steps in to output.txt, and I am seeing the following lines in that.
WARNING: Could not register reflection metadata for org.springframework.cloud.function.adapter.aws.CustomRuntimeInitializer. Reason: java.lang.NoClassDefFoundError: org/springframework/cloud/function/web/source/DestinationResolver.

the spring-graals-native version is 0.70.BUILD-SNAPSHOT.jar
the spring-cloud-function version is 3.1.0-SNAPSHOT
The pom file can be found here.
Also, in aws console, I am able to test only with the handler of type FunctionInvoker and not using SpringBootApiGatewayRequestHandler.

Below dependencies need to be added for successful native image compilation.
<!-- Required by DestinationResolver -->
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

<!-- "spring-cloud-function-adapter-aws" coupled with webFlux-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-function-web</artifactId>
        </dependency>

