Skip to content

Commit 8e70836

Browse files
committed
Updated SpringBoot 2 sample to latest code
1 parent 39756cd commit 8e70836

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/Application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
@SpringBootApplication
2323
@Import({ PetsController.class })
24-
public class Application extends SpringBootServletInitializer {
24+
public class Application {
2525

2626
// silence console logging
2727
@Value("${logging.level.root:OFF}")

samples/springboot2/pet-store/src/main/java/com/amazonaws/serverless/sample/springboot2/StreamLambdaHandler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ public class StreamLambdaHandler implements RequestStreamHandler {
2525
try {
2626
handler = SpringBootLambdaContainerHandler.getAwsProxyHandler(Application.class);
2727

28+
// For applications that take longer than 10 seconds to start, use the async builder:
29+
// long startTime = Instant.now().toEpochMilli();
30+
// handler = new SpringBootProxyHandlerBuilder()
31+
// .defaultProxy()
32+
// .asyncInit(startTime)
33+
// .springBootApplication(Application.class)
34+
// .buildAndInitialize();
35+
2836
// we use the onStartup method of the handler to register our custom filter
2937
handler.onStartup(servletContext -> {
3038
FilterRegistration.Dynamic registration = servletContext.addFilter("CognitoIdentityFilter", CognitoIdentityFilter.class);

0 commit comments

Comments
 (0)