Spring boot 了解定制处理程序和SpringBootApiGatewayRequestHandler之间的区别

Spring boot 了解定制处理程序和SpringBootApiGatewayRequestHandler之间的区别,spring-boot,spring-cloud-function,Spring Boot,Spring Cloud Function,我不熟悉Spring云功能,并将其作为开发基于FaaS的解决方案的最佳解决方案之一。我专门为AWS Lambda服务编写应用程序,该服务是API网关的后端。我在我的测试应用程序中遇到了一个非常有趣的问题,它是关于Handler的。我的测试应用程序与自定义处理程序配合得很好,编写方式如下- public class UserProfileHandler extends SpringBootRequestHandler<APIGatewayProxyRequestEvent, APIGatew

我不熟悉Spring云功能,并将其作为开发基于FaaS的解决方案的最佳解决方案之一。我专门为AWS Lambda服务编写应用程序,该服务是API网关的后端。我在我的测试应用程序中遇到了一个非常有趣的问题,它是关于Handler的。我的测试应用程序与自定义处理程序配合得很好,编写方式如下-

public class UserProfileHandler extends SpringBootRequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
}

Ganesh,我相信你已经在SCF的Github中提出了这个问题。正如我在这里所说的,我们最近做了一些增强,通过添加一个

也就是说,使用新的通用请求处理程序,您不再需要提供AWS请求处理程序的实现,包括
SpringBootApiGatewayRequestHandler

只需编写引导应用程序以包含函数bean

@SpringBootApplication
public class FunctionConfiguration {

    public static void main(String[] args) {
        SpringApplication.run(FunctionConfiguration.class, args);
    }

    @Bean
    public Function<String, String> uppercase() {
        return value -> value.toUpperCase();
    }
}
@springboot应用程序
公共类函数配置{
公共静态void main(字符串[]args){
run(FunctionConfiguration.class,args);
}
@豆子
公共函数大写(){
返回值->value.toUpperCase();
}
}

。并指定
org.springframework.cloud.function.adapter.aws.FunctionInvoker
作为aws仪表板中的处理程序。我们将为您完成其余工作。

升级到3.0.1后,解决了一个问题。谢谢您的帮助。我们如何在本地测试该功能?我们必须依赖包括spring boot web的服务吗?我不确定我是否理解您的问题。它是一个函数,您可以在单元测试中调用它的
apply
方法。
@SpringBootApplication
public class FunctionConfiguration {

    public static void main(String[] args) {
        SpringApplication.run(FunctionConfiguration.class, args);
    }

    @Bean
    public Function<String, String> uppercase() {
        return value -> value.toUpperCase();
    }
}