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.1k
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
250
Kotlin 最新動向2022 #tfcon #techfeed
ntaro
1
2.1k
#Ubie 狂気の認知施策と選考設計
ntaro
13
12k
UbieにおけるサーバサイドKotlin活用事例
ntaro
1
1k
KotlinでSpring 完全理解ガイド #jsug
ntaro
6
3.3k
Kotlinでサーバサイドを始めよう!
ntaro
1
900
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2.5k
Kotlin Contracts #m3kt
ntaro
4
3.7k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
420
Other Decks in Programming
See All in Programming
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
160
複雑さに立ち向かうための ソフトウェア開発入門
shiz
3
620
労務ドメインを快適に開発する方法 / How to Comfortably Develop in the Labor Domain
yuki21
1
250
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
1
1k
Web技術を駆使してユーザーの画面を「録画」する
yukukotani
13
6.3k
初めてのiOS関連GitHub ActionsをMarketplaceに公開するまでの実録
konifar
3
200
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
4
660
Swiftで高速フーリエ変換してオーディオビジュアライザーを作る / iOSDC Japan 2024 Day1 Track D
kyome22
2
470
めざせ!WKWebViewマスター! / WKWebView Master
marcy731
3
520
LangGraphでのHuman-in-the-Loopの実装
os1ma
3
780
令和トラベルにおけるLLM活用事例:社内ツール開発から得た学びと実践
ippo012
0
110
ECMAScript仕様を読むのに必要な知識 - ダイジェスト版
syumai
4
2.5k
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
5 minutes of I Can Smell Your CMS
philhawksworth
201
19k
The Invisible Side of Design
smashingmag
295
50k
Docker and Python
trallard
39
3k
We Have a Design System, Now What?
morganepeng
48
7.1k
A Tale of Four Properties
chriscoyier
155
22k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
103
47k
Building Adaptive Systems
keathley
36
2.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
22
3.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
47
2.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
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!