This application is part of the Lightweight Java Tech Assessment. It's mainly focused on Spring Native with Graalvm.
To build the regular Spring Boot application, run the following command:
cd app
./gradlew clean build
To run the regular Spring Boot application, run the following command:
./gradlew bootRun
Once it's running in local, to test things out, try
localhost:8080/airports
To build the Spring Native application, run the following command(build time for native takes way longer than regular spring boot, grab a coffee):
cd app
./gradlew clean nativeCompile
This will create an executable app/build/native/nativeCompile/app
Once the build is done, run the following command:
.app/build/native/nativeCompile/app
Once it's running, to test things out, try
localhost:8080/airports
The application currently only build into native image and deploy to AWS lambda via CDK.
To bootstrap the AWS environment:
cd infra
cdk bootstrap --toolkit-stack-name=GSNCDKToolkit --qualifier=graalvm-spring-native -v
To build and deploy the application, make sure docker is running then:
cdk deploy
This will pull the docker image, build the native image and deploy to AWS lambda.
The reason this will build the project again is that the previous nativeCompile
will only build the executable based on
you local machine OS. However, to customize runtime on AWS lambda is based on Linux, which requires the executable build on
Linux image. So, we need to build the native image again. Time to grab your second coffee,this process will take a while.