Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Spring Fu on GraalVM
Taro Nagasawa
June 27, 2018
Programming
0
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
Kotlin 最新動向2022 #tfcon #techfeed
ntaro
1
1.7k
#Ubie 狂気の認知施策と選考設計
ntaro
12
10k
UbieにおけるサーバサイドKotlin活用事例
ntaro
1
860
KotlinでSpring 完全理解ガイド #jsug
ntaro
6
2.8k
Kotlinでサーバサイドを始めよう!
ntaro
1
730
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2k
Kotlin Contracts #m3kt
ntaro
4
2.9k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
320
Kotlin Fest 2018 - Opening session
ntaro
0
4.1k
Other Decks in Programming
See All in Programming
Rによる大規模データの処理
s_uryu
2
640
Zynq MP SoC で楽しむエッジコンピューティング ~RTLプログラミングのススメ~
ryuz88
0
370
フロントエンドで 良いコードを書くために
t_keshi
3
1.6k
OSC大阪 パスワード認証は人類には早すぎる ~ IDaaSを使ったソーシャルログインのすすめ ~
authyasan
7
1.5k
Most Valuable Bug(?) ~インシデント未遂から得た学び~
tatsumiakahori
0
150
ipa-medit: Memory search and patch tool for IPA without Jailbreaking/ipa-medit-bh2022-europe
tkmru
0
130
WordPress(再)入門 - 基礎知識・環境編
oleindesign
1
140
低レイヤーから始める GUI
fadis
18
9.4k
新卒でサービス立ち上げから Hasuraを使って3年経った振り返り
yutorin
0
230
jq at the Shortcuts
cockscomb
1
430
量子コンピュータ時代のプログラミングセミナー / 20230119_Amplify_seminar _shift_optimization
fixstars
0
190
NGK2023S - OCaml最高! スマホ開発にも使えちゃう?!
haochenxie
0
120
Featured
See All Featured
Done Done
chrislema
178
14k
Fantastic passwords and where to find them - at NoRuKo
philnash
32
1.9k
Code Reviewing Like a Champion
maltzj
508
38k
Visualization
eitanlees
128
12k
Imperfection Machines: The Place of Print at Facebook
scottboms
254
12k
Learning to Love Humans: Emotional Interface Design
aarron
263
38k
Rebuilding a faster, lazier Slack
samanthasiow
69
7.5k
Side Projects
sachag
451
37k
The Illustrated Children's Guide to Kubernetes
chrisshort
22
43k
Automating Front-end Workflow
addyosmani
1351
200k
Music & Morning Musume
bryan
37
4.6k
WebSockets: Embracing the real-time Web
robhawkes
58
6k
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!