Release 1.1
·
1365 commits
to main
since this release
Version 1.1 includes new performance improvements and bug fixes.
Performance improvements
- All setup code has been moved to the static initializer method. If you follow the instructions in our documentation and archetypes to include the handler creation code in a
staticblock you will see a drop in cold start latency.
private static SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;
static {
try {
handler = SpringBootLambdaContainerHandler.getAwsProxyHandler(Application.class);
} catch (ContainerInitializationException e) {
e.printStackTrace();
}
}- When using Spring profiles, we have added a new static method that receives a
ConfigurableWebApplicationContextas well as a vararg list of profile names. Using this method will ensure that the application is initialized only once with the correct profile.
AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
applicationContext.register(PetStoreSpringAppConfig.class);
handler = SpringLambdaContainerHandler.getAwsProxyHandler(applicationContext, "profile-1", "profile-2");- Setting profiles after the handler is initialized using the
activateSpringProfilesmethod will cause the Spring context to reload and slow down the following request. - Behind the scenes we moved the initialization of
ObjectMapper,ObjectReader, andObjectWriterto theLambdaContainerHandlerconstructor. This will ensure that they are initialized in the static code block. - Archetype and examples for Spring now include the
spring-context-indexeras a dependency.
Bug fixes
- Added a
logback.xmlconfiguration file for Spring and SpringBoot that sets the log level toERROR. This addresses #134 to make Spring and SpringBoot applications testable with SAM Local. - Added
apiKeyIdto the request identity model to address #136. - New whitelist for hosts, ports, and base paths (#138). For applications that need to dynamically generate links, we've added the ability to read the forwarded host, and port headers. To secure this, developers have to explicitly whitelist custom domain names:
LambdaContainerHandler.getContainerConfig().addCustomDomain("api.myserver.com");