Skip to content

Activate Spring profile support for SpringBootLambdaContainerHandler #88

Closed
@adsil2

Description

@adsil2

I have integrated my Spring boot application into the lambda runtime using this library. How do I support multiple profiles of runtime execution. I know this is possible in the SpringLambdaContainerHandler:

SpringLambdaContainerHandler.getAwsProxyHandler().activateSpringProfiles("dev");

Here is example of my code:

public class LambdaHandler implements RequestHandler<AwsProxyRequest, AwsProxyResponse> {

    private SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;
    private Logger log = LoggerFactory.getLogger(LambdaHandler.class);

    public LambdaHandler() throws Exception {

        long milis = System.currentTimeMillis();
        handler = SpringBootLambdaContainerHandler.getAwsProxyHandler(TestApplication.class);
        log.info("Loading time: " + (System.currentTimeMillis() - milis));
    }

    public AwsProxyResponse handleRequest(AwsProxyRequest awsProxyRequest, Context context) {
        log.info("*************** Handling REQUEST -LAMBDA  *********** received: " + awsProxyRequest.toString());
        log.info("*************** Handling REQUEST -LAMBDA  ***********  context: " + context.toString());
        log.info("*************** Handling REQUEST -LAMBDA  *********** endpoint path: " + awsProxyRequest.getPath());
        log.info("*************** Handling REQUEST -LAMBDA  *********** endpoint method : " + awsProxyRequest.getHttpMethod());
        log.info("*************** Handling REQUEST -LAMBDA  *********** endpoint paremeters: " + awsProxyRequest.getQueryStringParameters());
        log.info("*************** Handling REQUEST -LAMBDA  *********** endpoint resource: " + awsProxyRequest.getResource());
        return handler.proxy(awsProxyRequest, context);
    }


}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions