AWS Serverless Java container
AWS Serverless Java container
The AWS Serverless Java Container is a library that allows you to run Spring and Spring Boot applications inside AWS Lambda. It acts as a proxy and translator between the AWS Lambda runtime and the Spring framework. It translates incoming events from Amazon API Gateway or Application Load Balancers into cloud function method invocations.
The Container processes requests in the following way:

- Event Trigger: AWS Lambda receives an event that triggers the function execution.
- Lambda Handler Invocation: The AWS Lambda runtime invokes the configured handler class.
FunctionInvokerActivation: The handler delegates the event processing to theFunctionInvoker.- Function Resolution & Input Adaptation:
FunctionInvokeridentifies and loads the appropriate Spring Cloud Function bean from the application context. It uses theSPRING_CLOUD_FUNCTION_DEFINITIONenvironment variable to look up the bean in the ApplicationContext. If this variable is missing, it tries to find a single bean of typeFunction,Consumer, orSupplier.ℹ️The first time the container starts, theFunctionInvokertriggers the Spring Boot startup sequence. This ensures that when the “Event Trigger” happens, the beans are already “warm” and ready for resolution, though the very first request will still bear the “Cold Start” penalty of booting the entire Spring framework. If your Spring Boot app takes longer than 10 seconds to start, the container can boot it in a background thread to prevent Lambda from timing out during the cold start.FunctionInvokerconverts the incoming Lambda event payload into the input type expected by the function.
- Function Execution: The resolved function executes with the adapted input.
- Output Adaptation & Response:
FunctionInvokerconverts the function’s output into a format suitable for Lambda responses. This response is returned back through the Lambda runtime to the event source.
The FunctionInvoker acts as the vital adapter component connecting AWS Lambda’s native event-driven model with Spring Cloud Function’s Java-based functional programming model, orchestrating input/output transformations and function invocation seamlessly in the internal lifecycle.