Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Spring Fu on GraalVM
Search
Taro Nagasawa
June 27, 2018
Programming
0
2.2k
Spring Fu on GraalVM
Kotlin Developers Meetup (
https://kotlin.connpass.com/event/90679/
) で発表したスライドです
Taro Nagasawa
June 27, 2018
Tweet
Share
More Decks by Taro Nagasawa
See All by Taro Nagasawa
Android開発者のための Kotlin Multiplatform入門
ntaro
0
780
Kotlin 最新動向2022 #tfcon #techfeed
ntaro
1
2.3k
#Ubie 狂気の認知施策と選考設計
ntaro
13
13k
UbieにおけるサーバサイドKotlin活用事例
ntaro
1
1.1k
KotlinでSpring 完全理解ガイド #jsug
ntaro
6
3.5k
Kotlinでサーバサイドを始めよう!
ntaro
1
1k
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2.8k
Kotlin Contracts #m3kt
ntaro
4
4.2k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
520
Other Decks in Programming
See All in Programming
Pull-Requestの内容を1クリックで動作確認可能にするワークフロー
natmark
2
450
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
370
開発生産性を上げるための生成AI活用術
starfish719
1
170
Pythonスレッドとは結局何なのか? CPython実装から見るNoGIL時代の変化
curekoshimizu
4
1.3k
Le côté obscur des IA génératives
pascallemerrer
0
120
Breaking Up with Big ViewModels — Without Breaking Your Architecture (droidcon Berlin 2025)
steliosf
PRO
1
330
CI_CD「健康診断」のススメ。現場でのボトルネック特定から、健康診断を通じた組織的な改善手法
teamlab
PRO
0
180
育てるアーキテクチャ:戦い抜くPythonマイクロサービスの設計と進化戦略
fujidomoe
1
150
Serena MCPのすすめ
wadakatu
4
900
uniqueパッケージの内部実装を支えるweak pointerの話
magavel
0
920
ソフトウェア設計の実践的な考え方
masuda220
PRO
3
480
猫と暮らすネットワークカメラ生活🐈 ~Vision frameworkでペットを愛でよう~ / iOSDC Japan 2025
yutailang0119
0
220
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
45
2.5k
GraphQLとの向き合い方2022年版
quramy
49
14k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
KATA
mclloyd
32
15k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Invisible Side of Design
smashingmag
301
51k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
2.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
960
Automating Front-end Workflow
addyosmani
1371
200k
Building Adaptive Systems
keathley
43
2.8k
Transcript
Spring Fu on GraalVM 2018-06-27 Taro Nagasawa
Taro - たろう • @ngsw_taro • Organizer of Japan Kotlin
User Group
Redesign Medical Care
GraalVM • Platform developed by Oracle • Polyglot VM ◦
JVM-based languages (Java, Scala, Kotlin! …) ◦ JavaScript, Python, Ruby, R ◦ LLVM-based languages (C, C++, ...) • AOT Compiler ◦ Java code is compiled to native code • Community Edition / Enterprise Edition
$ docker run --rm findepi/graalvm java -version openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-11) GraalVM 1.0.0-rc2 (build25.71-b01-internal-jvmci -0.43, mixed mode)
Familiar Spring Boot application @SpringBootApplication class DemoApplication fun main(args: Array<String>)
{ runApplication<DemoApplication>(*args) } @Service class HelloService { fun hello(): String = "Hello, world!" } @RestController class HelloController(val helloService: HelloService) { @GetMapping("") fun hello(): String = helloService.hello() }
$ ./gradlew bootRun $ curl http://localhost:8080 Hello, world! Spring app
written in Kotlin runs on GraalVM
$ ./gradlew assemble $ native-image -jar\ build/libs/demo-0.0.1-SNAPSHOT.jar Native
$ ./gradlew assemble $ native-image -jar\ build/libs/demo-0.0.1-SNAPSHOT.jar Error: com.oracle.graal.pointsto.constraints.Un supportedFeatureException:
Unsupported field jav a.net.URL.handlers is reachable Native
Spring Fu • Micro-framework for Kotlin • Like Spring 5
functional registration
Hello, Spring Fu class HelloService { fun hello(): String =
"Hello, world!" } class HelloController(val helloService: HelloService) { fun hello(request: ServerRequest): Mono<ServerResponse> { val hello = helloService.hello() return ServerResponse.ok().syncBody(hello) } }
Hello, Spring Fu fun main(args: Array<String>) = application { bean<HelloService>()
bean<HelloController>() webflux { server(netty(8080)) { routes { this.context =
[email protected]
val helloController = ref<HelloController>() GET("/", helloController::hello) } } } }.run(await = true)
Hello, Spring Fu fun main(args: Array<String>) = application { bean<HelloService>()
bean<HelloController>() webflux { server(netty(8080)) { routes { this.context =
[email protected]
val helloController = ref<HelloController>() GET("/", helloController::hello) } } } }.run(await = true)
$ ./gradlew bootRun $ curl http://localhost:8080 Hello, world! Spring Fu
app runs on GraalVM
$ ./gradlew assemble $ native-image -jar build/libs/app.jar Native!
$ ./gradlew assemble $ native-image -jar build/libs/app.jar Error: com.oracle.graal.pointsto.constraints.Un supportedFeatureException:
Unsupported field jav a.net.URL.handlers is reachable Native!
Spring Fu does not support GraalVM AOT compiler
None
One more thing...
Kotlin Fest 2018 Tokyo Aug. 25th More information coming soon.
Thank you! Enjoy Kotlin!