This is my ServiceHandler class

public class StreamLambdaHandler implements RequestStreamHandler {
private final static   
SpringLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;

static  {
    handler = new SpringProxyHandlerBuilder()
            .defaultProxy()
            .asyncInit()
            .configurationClasses(SlowAppConfig.class)
            .buildAndInitialize();
} 
@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context)
        throws IOException {
TestService.testMethod();
}
}

This is my class in which i want to call non static method inside static method so i have used springContext but at the time of initilization springContext is getting null.Can any please help me call this method inside static method

@Service
public class TestService implements ApplicationContextAware{
public ststic ApplicationContext springContext;
@Override
public void setApplicationContext(Application applicationContext){
this.springContext= appilicationContext
}

public static void testMethod(){
TestService testService = springContext.getBean(TestService.class);

TestService.testMethod2 
}

public void testMethod2(){
}
}

Tried this but my application is taking more than 10 sec to run so need to use asynInit

handler = SpringBootLambdaContainerHandler.getAWSProxyHandler(Application.class)
0

There are 0 best solutions below