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
530
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
950
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2.6k
Kotlin Contracts #m3kt
ntaro
4
3.9k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
470
Other Decks in Programming
See All in Programming
Formの複雑さに立ち向かう
bmthd
1
890
React 19アップデートのために必要なこと
uhyo
3
710
Django NinjaによるAPI開発の効率化とリプレースの実践
kashewnuts
1
150
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
280
Serverless Rust: Your Low-Risk Entry Point to Rust in Production (and the benefits are huge)
lmammino
1
140
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
40
15k
DROBEの生成AI活用事例 with AWS
ippey
0
140
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
380
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
160
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
5
390
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.8k
Rubyで始める関数型ドメインモデリング
shogo_tksk
0
120
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
67
4.6k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Six Lessons from altMBA
skipperchong
27
3.6k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
Building Your Own Lightsaber
phodgson
104
6.2k
Building an army of robots
kneath
303
45k
Navigating Team Friction
lara
183
15k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
100
18k
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!