Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't that be !"on-demand" to cover "provisioned-concurrency" as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, although I am not quite sure what 'on-demand' is

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you can change s-c-function version from snapshot to 4.1.1 as we just had a release

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime

AWS_LAMBDA_INITIALIZATION_TYPE – The initialization type of the function, which is on-demand, provisioned-concurrency, or snap-start.

For provisioned-concurrency it would also make sense to initialize the context earlier - therefore !("on-demand") would cover this as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahha, got it. will add

mvc.waitForContext();
}
this.mapper = new ObjectMapper();
this.responseWriter = new AwsProxyHttpServletResponseWriter();
}
Expand Down