Skip to content

Commit 17afb9a

Browse files
committed
GH-805 Fix web context initialization during snapstart
Also updated to s-c-function-serverless-webb 4.1.1-SNAPSHOT This commit forces wait for full context initialization if context is created during snapstart creation
1 parent 79b6d34 commit 17afb9a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

aws-serverless-java-container-springboot3/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<dependency>
2626
<groupId>org.springframework.cloud</groupId>
2727
<artifactId>spring-cloud-function-serverless-web</artifactId>
28-
<version>4.0.6</version>
28+
<version>4.1.1-SNAPSHOT</version>
2929
</dependency>
3030
<dependency>
3131
<groupId>com.amazonaws.serverless</groupId>

aws-serverless-java-container-springboot3/src/main/java/com/amazonaws/serverless/proxy/spring/SpringDelegatingLambdaContainerHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public SpringDelegatingLambdaContainerHandler() {
5353
public SpringDelegatingLambdaContainerHandler(Class<?>... startupClasses) {
5454
this.startupClasses = startupClasses;
5555
this.mvc = ServerlessMVC.INSTANCE(this.startupClasses);
56+
if (System.getenv().containsKey("AWS_LAMBDA_INITIALIZATION_TYPE")
57+
&& System.getenv().get("AWS_LAMBDA_INITIALIZATION_TYPE").equals("snap-start")) {
58+
mvc.waitForContext();
59+
}
5660
this.mapper = new ObjectMapper();
5761
this.responseWriter = new AwsProxyHttpServletResponseWriter();
5862
}

0 commit comments

Comments
 (0)