0

I have two maven projects. I have created a jar file from one project (by using mvn package) and imported it into another maven project. I have included the jar file in my final maven package jar by adding a maven dependency and then using maven shade and assembly plugin to create a full fat jar. Here are the links I've followed.

https://intellipaat.com/community/6786/how-to-add-local-jar-files-to-a-maven-project How to add local jar files to a Maven project? http://tutorials.jenkov.com/maven/maven-build-fat-jar.html

Somehow nothing seems to budge the error and whenever I upload my code over aws lambda, the error is consistent and the classes inside my external jar are not found.

Naman
  • 27,789
  • 26
  • 218
  • 353

1 Answers1

0

If you are using spring and cloud-server-function, to autowire, in AWS Lambda you need to add code below and put the autowired in the same package

static AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Fam.class.getPackage().getName());
public Fam() { ctx.getAutowireCapableBeanFactory().autowireBean(this); }

Learn more here:

aws lambda function with spring autowired dependencies

https://www.profit4cloud.nl/blog/just-spring-enabled-aws-lambdas/

pellyadolfo
  • 981
  • 10
  • 23