Skip to content

Commit

Permalink
awsGH-805 Fix web context initialization during snapstart
Browse files Browse the repository at this point in the history
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
  • Loading branch information
olegz committed Mar 26, 2024
1 parent 79b6d34 commit 17afb9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aws-serverless-java-container-springboot3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-serverless-web</artifactId>
<version>4.0.6</version>
<version>4.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.amazonaws.serverless</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public SpringDelegatingLambdaContainerHandler() {
public SpringDelegatingLambdaContainerHandler(Class<?>... startupClasses) {
this.startupClasses = startupClasses;
this.mvc = ServerlessMVC.INSTANCE(this.startupClasses);
if (System.getenv().containsKey("AWS_LAMBDA_INITIALIZATION_TYPE")
&& System.getenv().get("AWS_LAMBDA_INITIALIZATION_TYPE").equals("snap-start")) {
mvc.waitForContext();
}
this.mapper = new ObjectMapper();
this.responseWriter = new AwsProxyHttpServletResponseWriter();
}
Expand Down

0 comments on commit 17afb9a

Please sign in to comment.