GraalVM Native
Kora creates its helper classes at compile time, does not use the Reflection API at runtime, does not use dynamic proxies, does not generate bytecode at compile time or runtime, so there are no problems building native image from Kora perspective.
Example of building a native image using plugin for gradle
:
Plugin build.gradle
:
Plugin setup build.gradle
:
graalvmNative {
binaries {
main {
imageName = "application"
mainClass = "ru.tinkoff.kora.example.Application"
debug = true
verbose = true
buildArgs.add("--report-unsupported-elements-at-runtime")
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.matching("GraalVM Community")
}
}
}
metadataRepository {
enabled = true
}
}
Plugin build.gradle.kts
:
Plugin setup build.gradle.kts
:
graalvmNative {
binaries {
named("main") {
imageName.set("application")
mainClass.set("ru.tinkoff.kora.example.Application")
debug.set(true)
verbose.set(true)
buildArgs.add("--report-unsupported-elements-at-runtime")
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.matching("GraalVM Community")
}
}
}
metadataRepository {
enabled.set(true)
}
}
Some libraries require additional configuration, some configurations are made in Kora.
Tested modules that should work without additional configuration:
- Configuration
- Json
- Logback
- Probes
- Metrics
- Tracing
- HTTP server
- HTTP client
- OpenAPI generation
- OpenAPI mapping
- JDBC (Postgres) database
- R2DBC (Postgres) database
- Database Vertx (Postgres)
- Cassandra database
- Kafka
- gRPC Server
- gRPC client
- resilient
- Cache
- Validation
- Scheduling
- Logging
See examples of working native services at repository with examples.