All Projects → wandi34 → springboot-helloworld-native

wandi34 / springboot-helloworld-native

Licence: other
Example helloWorld SpringBoot project which compiles to native code with GraalVM

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to springboot-helloworld-native

Google-Authenticator
Clojure program to compute your google authenticator OTP using TOTP
Stars: ✭ 23 (+64.29%)
Mutual labels:  graalvm, native-image
native-build-tools
Native-image plugins for various build tools
Stars: ✭ 168 (+1100%)
Mutual labels:  graalvm, native-image
graalvm-native-image-plugin
A Gradle plugin which creates a native executable via GraalVM's native-image. This is a thin wrapper of the native-image command.
Stars: ✭ 90 (+542.86%)
Mutual labels:  graalvm, native-image
connor
A commandline tool for resetting Kafka Connect source connector offsets.
Stars: ✭ 17 (+21.43%)
Mutual labels:  graalvm, native-image
holy-lambda
The extraordinary simple, performant, and extensible custom AWS Lambda runtime for Clojure.
Stars: ✭ 318 (+2171.43%)
Mutual labels:  graalvm, native-image
Picocli
Picocli is a modern framework for building powerful, user-friendly, GraalVM-enabled command line apps with ease. It supports colors, autocompletion, subcommands, and more. In 1 source file so apps can include as source & avoid adding a dependency. Written in Java, usable from Groovy, Kotlin, Scala, etc.
Stars: ✭ 3,286 (+23371.43%)
Mutual labels:  graalvm, native-image
ghidraal
A Ghidra extension for scripting with GraalVM languages, including Javascript, Python3, R, and Ruby.
Stars: ✭ 48 (+242.86%)
Mutual labels:  graalvm
skycloud-base
🔥springcloud脚手架,配置中心(apollo/nacos) 注册中心(consul/nacos) 分布式事物(seata) 调用链(skywalking) 日志(ELK)监控(prometheus与grafana) 等,适合学习与快速开发使用
Stars: ✭ 80 (+471.43%)
Mutual labels:  springboot
Sureness
A simple and efficient open-source security framework that focus on protection of restful api.
Stars: ✭ 254 (+1714.29%)
Mutual labels:  springboot
Luna Commons
市场上许多界面和工具的集合,例如ftp,httpd等文件与工具操作,包括但不限于图像处理、人脸识别等的api。
Stars: ✭ 244 (+1642.86%)
Mutual labels:  springboot
javarush-telegrambot
JavaRush Telegram bot from the community to the community. All the process of software development of this bot is described in series of posts
Stars: ✭ 101 (+621.43%)
Mutual labels:  springboot
HumanResources
Account Registration and Confirmation. Exception Handling. Caching with Redis.Mail sender by Apache Kafka.Notification send with RabbitMq.
Stars: ✭ 19 (+35.71%)
Mutual labels:  springboot
scala-http4s-realworld-example-app
Example of a RealWorld app backend powered by Scala + http4s
Stars: ✭ 35 (+150%)
Mutual labels:  graalvm
micronaut-camunda-external-client
This open source project allows you to easily integrate Camunda's External Task Clients into Micronaut projects: simply add a dependency in your Micronaut project
Stars: ✭ 19 (+35.71%)
Mutual labels:  graalvm
graalvm-ce-dev-builds
GraalVM Dev Build Downloads
Stars: ✭ 76 (+442.86%)
Mutual labels:  graalvm
Bus
Bus 是一个基础框架、服务套件,它基于Java8编写,参考、借鉴了大量已有框架、组件的设计,可以作为后端服务的开发基础中间件。代码简洁,架构清晰,非常适合学习使用。
Stars: ✭ 253 (+1707.14%)
Mutual labels:  springboot
openapi4j
OpenAPI 3 parser, JSON schema and request validator.
Stars: ✭ 92 (+557.14%)
Mutual labels:  graalvm
qbicc
Experimental static compiler for Java programs.
Stars: ✭ 118 (+742.86%)
Mutual labels:  native-image
grakkit
A modern JavaScript development environment for Minecraft.
Stars: ✭ 184 (+1214.29%)
Mutual labels:  graalvm
mozart-graal
An implementation of Oz on top of Truffle and Graal
Stars: ✭ 37 (+164.29%)
Mutual labels:  graalvm

Hello World app in SpringBoot compiled with GraalVM

Dependencies

  • Important: Because of #1057 this tutorial is only runable on Linux machines. (native image agent is only available for Linux)
  • Install GraalVM from here https://www.graalvm.org/ (Used version 20.0.0)
    • (For Mac OSX versions > Catalina: Remove quarantine from the bits, info)
      $ sudo xattr -r -d com.apple.quarantine path/to/graalvm/folder/
  • Configure your env
    • Prepend the GraalVM bin directory to the PATH environment variable:
      $ export PATH=<path to GraalVM>/Contents/Home/bin:$PATH.
      To verify whether you are using GraalVM, run: $ which java
    • Set the JAVA_HOME environment variable to resolve to the GraalVM installation directory:
      $ export JAVA_HOME=<path to GraalVM>/Contents/Home
    • (Specify GraalVM as the JRE or JDK installation in your Java IDE)

Version Information

  • GraalVM 20.0.0 was the latest version available to download. Newer releases should have fix for Bug oracle/graal#2198
  • SpringBoot 2.3.x was needed for GraalVM native-image support

Benchmark

The application is very simple (just giving out "Hello World" at localhost:8080 but nevertheless the performance difference is significant:

Spring Boot JVM Spring Boot Native
Startup: Started GraalDemoApplication in 1.305 seconds (JVM running for 1.644) Startup: Started GraalDemoApplication in 0.066 seconds (JVM running for 0.068)
RAM Usage: ca 502.9 MB RAM Usage: ca 37 MB
Size: 16 MB Size: 89 MB

Compile

The following steps are needed to compile the spring boot application to native code with GraalVm

mvn -DskipTests clean package
export MI=src/main/resources/META-INF
mkdir -p $MI 
java -agentlib:native-image-agent=config-output-dir=${MI}/native-image -jar target/<YOUR_APP_ARTIFACT>.jar

## Due to https://github.com/oracle/graal/issues/2198 you have to add a class to reflect-config.json. Maybe its fixed in GraalVM version > 20.0.0
{
 "name":"org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl",
 "allDeclaredConstructors":true,
 "allDeclaredMethods":true
},

## Check if the application is working correctly: http://localhost:8080
## then hit CTRL + C to stop the running application.

tree $MI
mvn -Pgraal clean package

Start the application

After successfully compiling the application you can start the application with ./target/de.wandi34.graaldemo.graaldemoapplication

Resources

Application was built with following documentations:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].