运行graals本机Spring Cloud功能示例

问题描述

我试图在spring-graals中运行aws函数示例,'java'版本运行良好,但是当我测试'native'版本时,在控制台中看到以下错误。

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

该示例将步骤登录到output.txt,在其中看到以下几行。

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.

spring-graals-native版本为0.70.BUILD-SNAPSHOT.jar

spring-cloud-function版本是3.1.0-快照

pom文件可以为Workbench

此外,在aws控制台中,我只能使用类型为FunctionInvoker的处理程序进行测试,而不能使用SpringBootApiGatewayRequestHandler

解决方法

为了成功完成本机图像编译,需要添加以下依赖项。

[
    ["Women's Clothing","Tshirt","Trending"],["Women's Clothing","Promotion"],["Shoes","Hiking Shoe","Winter Shoe"]
]

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...