Skip to content

asyncInit() stopped working on release 1.5 #391

@vinilanzoni

Description

@vinilanzoni

To help us debug your issue fill in the basic information below using the options provided

Serverless Java Container version: 1.5

Implementations: Spring Boot 2

Framework version: SpringBoot 2.2.7.RELEASE

Frontend service: HTTP API

Deployment method: CloudFormation

Scenario

I'm trying to implement a new application using SpringBoot 2.2.7. But when I use asyncInit() i get the error Cannot resolve method 'springBootApplication' in 'ServletLambdaContainerHandlerBuilder'

                ContainerConfig lambdaContainerConfig = LambdaContainerHandler.getContainerConfig();
                lambdaContainerConfig.setInitializationTimeout(20_000);
                lambdaContainerConfig.setDefaultContentCharset(StandardCharsets.UTF_8.name());
                // For applications that take longer than 10 seconds to start, use the async builder:
                long startTime = Instant.now().toEpochMilli();
                handler = new SpringBootProxyHandlerBuilder()
                        .defaultProxy()
                        .asyncInit()
                        .springBootApplication(Application.class)         // Here I get the error Cannot resolve method 'springBootApplication' in 'ServletLambdaContainerHandlerBuilder'
                        .buildAndInitialize();

This only happens when I use version 1.5, when I downgrade to 1.4 the error stop showing.
asyncInit() returns ServletLambdaContainerHandlerBuilder on version 1.5 but on version 1.4 it returns SpringBootProxyProxyHandlerBuilder.
Furthermore, why asyncInit(Long startTime) is deprecated on version greater than 1.5?

Expected behavior

Not showing error Cannot resolve method 'springBootApplication' in 'ServletLambdaContainerHandlerBuilder'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions