Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncInit() stopped working on release 1.5 #391

Closed
vinilanzoni opened this issue Oct 19, 2020 · 4 comments
Closed

asyncInit() stopped working on release 1.5 #391

vinilanzoni opened this issue Oct 19, 2020 · 4 comments
Labels
Milestone

Comments

@vinilanzoni
Copy link

vinilanzoni commented Oct 19, 2020

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'

@vinilanzoni vinilanzoni changed the title asyncInit() stopped working on release 1.5.2 asyncInit() stopped working on release 1.5 Oct 20, 2020
@Y00sh00
Copy link

Y00sh00 commented Nov 7, 2020

I'm running into similar issues.

@jabhijeet
Copy link
Contributor

i am using 1.5.2 and no issues there

@Intelligent2013
Copy link

I have this issue for both 1.5 and 1.5.2.

COMPILATION ERROR :

my.example.StreamLambdaHandler.java:[37,17] cannot find symbol
  symbol:   method springBootApplication(java.lang.Class<my.example.Application>)
  location: class com.amazonaws.serverless.proxy.internal.servlet.ServletLambdaContainerHandlerBuilder

From pom.xml:

        <dependency>
            <groupId>com.amazonaws.serverless</groupId>
            <artifactId>aws-serverless-java-container-spring</artifactId>
            <version>1.5.2</version>
        </dependency>

I get the source code from https://github.com/awslabs/aws-serverless-java-container/wiki/Quick-start---Spring-Boot#asynchronous-initialization

@deki deki added the docs label Jan 3, 2022
deki added a commit that referenced this issue Jan 7, 2022
@deki
Copy link
Collaborator

deki commented Jan 7, 2022

Fixed code sample and wiki documentation

@deki deki closed this as completed Jan 7, 2022
@deki deki added this to the Release 1.7 milestone Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants