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
670
Kotlin 最新動向2022 #tfcon #techfeed
ntaro
1
2.2k
#Ubie 狂気の認知施策と選考設計
ntaro
13
13k
UbieにおけるサーバサイドKotlin活用事例
ntaro
1
1.1k
KotlinでSpring 完全理解ガイド #jsug
ntaro
6
3.4k
Kotlinでサーバサイドを始めよう!
ntaro
1
980
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2.7k
Kotlin Contracts #m3kt
ntaro
4
4.1k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
500
Other Decks in Programming
See All in Programming
FastMCPでMCPサーバー/クライアントを構築してみる
ttnyt8701
2
130
Go1.25からのGOMAXPROCS
kuro_kurorrr
0
130
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
250
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
180
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
200
ASP.NETアプリケーションのモダナイズ インフラ編
tomokusaba
1
210
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
2.9k
Create a website using Spatial Web
akkeylab
0
260
Practical Tips and Tricks for Working with Compose Multiplatform Previews (mDevCamp 2025)
stewemetal
0
120
Perplexity Slack Botを作ってAI活用を進めた話 / AI Engineering Summit プレイベント
n3xem
0
640
Parallel::Pipesの紹介
skaji
2
910
Effect の双対、Coeffect
yukikurage
5
1.4k
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
134
9.3k
Producing Creativity
orderedlist
PRO
346
40k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
Speed Design
sergeychernyshev
30
990
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
A designer walks into a library…
pauljervisheath
206
24k
Navigating Team Friction
lara
186
15k
How to Ace a Technical Interview
jacobian
276
23k
The Cult of Friendly URLs
andyhume
79
6.4k
Site-Speed That Sticks
csswizardry
10
630
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!