This project supports building native images using GraalVM Native Image. The native image provides faster startup times and lower memory footprint compared to running on the JVM.
- java 17
- SDKMAN (for managing Java versions)
- Docker (for containerized builds)
- Clone the Repository
git clone https://github.com/ADORSYS-GIS/webank-pending-registration-service.git
cd webank-pending-registration-service
- Install SDKMAN if not already installed:
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
- Install and use GraalVM:
# List available GraalVM versions
sdk list java | grep graalvm
# Install GraalVM 22.3.3
sdk install java 22.3.3.r17-grl
# Use GraalVM for current session
sdk use java 22.3.3.r17-grl
# Install native-image component
gu install native-image
# Verify installation
java -version # Should show GraalVM
native-image --version # Should show native-image version
- Enable GraalVM for the project:
# From project root
sdk env install
sdk use
The following environment variables are required, make to export them before running the application.
JWT_ISSUER
: JWT issuer URL (e.g., "https:webank.com")JWT_EXPIRATION_TIME_MS
: JWT expiration time in milliseconds (e.g., "172800000" for 48 hours)SERVER_PRIVATE_KEY_JSON
: Server private key in JWK formatSERVER_PUBLIC_KEY_JSON
: Server public key in JWK formatOTP_SALT
: A secure random string for OTP generationEMAIL
: Email address for sending OTPsPASSWORD
: Email password
docker-compose up -d
To build locally from the project root:
- Build the native image
mvn clean package -Pnative -DskipTests
# Run the application
./prs/prs-rest-server/target/prs-rest-server
The native executable will be generated in prs/prs-rest-server/target/prs-rest-server
.
- Build the normal jar
mvn clean install
cd prs/prs-rest-server
mvn spring-boot:run
To build using Docker:
#Make sure the environmental varaibles are exported
docker build -t webank-prs .
docker run -p 8080:8080 webank-prs
If you encounter issueswith building or running webank-pending-registration-service:
- Ensure environmental varaibles are correctly exported
- Run docker compose is running for external services.
- If running normal spring-boot ensure to run from
prs/prs-rest-server
If you encounter issues with the native build:
- Ensure SDKMAN is properly installed and configured
- Verify GraalVM is installed and selected:
sdk current java
- Check the reflection configuration in
reflect-config.json
- Review the native-image.properties file for initialization settings
- Run the
NativeReflectionHintScanner
class to get the reflection hints them add them to@RegisterReflectionForBinding
annotation in theNativeReflectionHintsConfig