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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
1.3k
Kotlin 最新動向2022 #tfcon #techfeed
ntaro
1
2.3k
#Ubie 狂気の認知施策と選考設計
ntaro
13
14k
UbieにおけるサーバサイドKotlin活用事例
ntaro
1
1.2k
KotlinでSpring 完全理解ガイド #jsug
ntaro
6
3.6k
Kotlinでサーバサイドを始めよう!
ntaro
1
1k
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2.9k
Kotlin Contracts #m3kt
ntaro
4
4.3k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
540
Other Decks in Programming
See All in Programming
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
130
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
250
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
150
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
170
モダンOBSプラグイン開発
umireon
0
160
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
610
Claude Code Skill入門
mayahoney
0
400
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
750
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
500
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
130
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
440
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
53k
Darren the Foodie - Storyboard
khoart
PRO
3
2.9k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
110
First, design no harm
axbom
PRO
2
1.1k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
100
RailsConf 2023
tenderlove
30
1.4k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
310
Rails Girls Zürich Keynote
gr2m
96
14k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Paper Plane
katiecoart
PRO
0
48k
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!