serverless-java-container is a free, open source api development & testing project written in Java and released under Apache-2.0. It has 1,565 GitHub stars, 574 forks and 113 open issues, and was last pushed 30 hours ago. On this registry it ranks #131 of 187 tracked projects in API Development & Testing, with 5 head-to-head comparisons available. It gained 2 stars over the last 30 tracked days.

What is serverless-java-container?

Serverless Java Container is an Apache-2.0 Java wrapper, published on Maven Central as com.amazonaws.serverless:aws-serverless-java-container, that lets teams run existing Spring, Spring Boot, Apache Struts, Jersey, or Spark applications inside AWS Lambda without rewriting them as native Lambda handlers.

What it is

The aws-serverless-java-container project is a Java library that adapts applications written against mainstream Java web frameworks — Spring, Spring Boot, Apache Struts, Jersey, and Spark — so they can execute inside AWS Lambda. It sits inside the AWS and API Gateway ecosystem and plugs into the Java build toolchain through Maven. Applications keep their framework configuration classes and injection models; the container supplies the bridge between the framework's expectations and the Lambda runtime.

The concrete problem it solves is deployment glue. An application built around Spring or JAX-RS assumes a long-running server that dispatches HTTP requests, while Lambda hands the developer a handler method and an event payload. This wrapper replaces hand-written translation code between API Gateway events and framework requests, and removes the need to host the application in a standalone server. It natively supports API Gateway's proxy integration models for both requests and responses, and developers can create and inject custom models for methods that use custom mappings.

Key capabilities

  • Native support for API Gateway's proxy integration models for requests and responses, plus custom model creation and injection for methods that use custom mappings.
  • Framework handler entry points such as SpringLambdaContainerHandler.getAwsProxyHandler(PetStoreSpringAppConfig.class), driven from a RequestStreamHandler implementation.
  • Request streaming through handler.proxyStream(inputStream, outputStream, context).
  • Initialization failure handling via ContainerInitializationException, with the documented pattern of re-throwing to force another cold start.
  • Three maintained version lines: 1.x on Java EE javax.* with Spring 5.x (Boot 2.x) and Jersey 2.x; 2.x on Jakarta EE 9-10 jakarta.* with Spring 6.x (Boot 3.x) and Jersey 3.x; 3.x on Jakarta EE 11 with Spring 7.x (Boot 4.x) and Jersey 3.x.
  • Wiki quick start guides for Spring, Spring Boot 2, Spring Boot 3, Spring Boot 4, Apache Struts, Jersey, and Spark.
  • A samples directory in the repository, with a step-by-step wiki guide for deploying those samples using Maven and SAM.

Who uses it and how

  • Teams with an existing Spring Boot 2 or Spring Boot 3 application who want to re-platform it onto Lambda without restructuring controllers or configuration classes.
  • Jersey and JAX-RS REST API owners exposing the service through API Gateway proxy integration.
  • Apache Struts and Spark users, who must remain on the 1.x line because Struts and Spark support is absent from 2.x and 3.x.
  • Developers validating a migration path by deploying the repository samples with Maven and SAM before touching production code.
  • Teams wanting a reference application: the project points to an AWS compute blog post on re-platforming Java applications and the "Java on AWS Lambda" workshop catalog.

Getting started

Add the Maven Central dependency com.amazonaws.serverless:aws-serverless-java-container to the project and follow the framework-specific quick start in the project wiki. The samples are deployed with Maven and AWS SAM.

How it compares

The facts provided name no comparable tools, so this project stands alone in this registry rather than displacing a listed alternative. Its nearest context is its own category, Developer Tools / API Development & Testing, and the AWS serverless ecosystem it targets.

When to use it — and when not to

Use it when the application already exists in one of the supported frameworks and the target runtime is Lambda behind API Gateway. Do not pick it if the application depends on Struts or Spark and the team needs the Jakarta EE jakarta.* namespace, since those frameworks are supported only on the 1.x javax.* line, and be aware that 3.x targets Jakarta EE 11 with Spring 7.x and Boot 4.x, which may run ahead of a production stack. The repository carries 113 open issues and maintains three parallel branches, so version selection deserves review; the README itself defers most integration detail to the wiki.

project readme (upstream, from github) — read inline

Serverless Java container Build Status Maven Central Help

The aws-serverless-java-container makes it easy to run Java applications written with frameworks such as Spring, Spring Boot, Apache Struts, Jersey, or Spark in AWS Lambda.

Serverless Java Container natively supports API Gateway's proxy integration models for requests and responses, you can create and inject custom models for methods that use custom mappings.

Currently the following versions are maintained:

Version Branch Java Enterprise support Spring versions JAX-RS/ Jersey version Struts support Spark support
1.x 1.x Java EE (javax.*) 5.x (Boot 2.x) 2.x :white_check_mark: :white_check_mark:
2.x 2.1.x Jakarta EE 9-10 (jakarta.*) 6.x (Boot 3.x) 3.x :x: :x:
3.x main Jakarta EE 11 (jakarta.*) 7.x (Boot 4.x) 3.x :x: :x:

Follow the quick start guides in our wiki to integrate Serverless Java Container with your project:

Below is the most basic AWS Lambda handler example that launches a Spring application. You can also take a look at the samples in this repository, our main wiki page includes a step-by-step guide on how to deploy the various sample applications using Maven and SAM.

public class StreamLambdaHandler implements RequestStreamHandler {
    private static final SpringLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;

    static {
        try {
            handler = SpringLambdaContainerHandler.getAwsProxyHandler(PetStoreSpringAppConfig.class);
        } catch (ContainerInitializationException e) {
            // if we fail here. We re-throw the exception to force another cold start
            e.printStackTrace();
            throw new RuntimeException("Could not initialize Spring framework", e);
        }
    }

    @Override
    public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context)
            throws IOException {
        handler.proxyStream(inputStream, outputStream, context);
    }
}

Public Examples

Blogs

Workshops

Videos

Java samples with different frameworks

Frequently asked questions

Is serverless-java-container free to use?

serverless-java-container is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does serverless-java-container do?

A Java wrapper to run Spring, Spring Boot, Jersey, and other apps inside AWS Lambda.

What is serverless-java-container written in?

serverless-java-container is primarily written in Java. Its source is publicly available at https://github.com/aws/serverless-java-container, and it has 1,565 GitHub stars.