Spring Boot & Kotlin: Pain or Gain? by Urs Peter @ Spring I/O 2024
Vložit
- čas přidán 22. 08. 2024
- Spring I/O 2024 - 30-31 May, Barcelona
Slides: 2024.springio....
Spring Boot has been the No. 1 framework for Java developers ever since. With its first-class support for Kotlin, a new frontier of possibilities opens up. Can Kotlin propel Spring Boot to new heights of efficiency and simplicity beyond what Java offers?
Join me on an enlightening journey as we explore the potential advantages and pitfalls of integrating Kotlin into the Spring Boot ecosystem. We’ll begin by dissecting Spring Boot’s support for Kotlin features such as extensions, data classes, nullability, and more. Can they live up to their promise of improved code safety, conciseness, and readability compared to their Java counterparts?
In the second part, we will venture into more advanced territory by investigating how reactive Spring Boot Webflux - highly efficient yet notorious for its complexity and steep learning curve - might be simplified using Coroutines, Kotlin’s built-in asynchronous language feature. Are the potential benefits worth the hassle of learning Coroutines? And yes, we’ll take a look at the role Virtual Threads can play in that regard!
Finally, we’ll dive into the practical realm, transforming a Spring Boot application written in Java to Kotlin on the spot using live coding to explore tooling support and possible conversion strategies, accompanied by intriguing stories from real-world use cases.
At the end of the journey, you have gained a nuanced understanding of the benefits and drawbacks Spring Boot offers when used with Kotlin compared to Java. Will the pain of adoption be worth the potential gain? Let’s find out together!
Great video! Under the heading of "more functional" I do wish Urs had mentioned the fact that many more things are expressions in Kotlin than in Java. For example, try, if, and when among others all return a value. This eliminates the all-too-common and error prone pattern of creating a local variable initialized to null upstream of a block, and then assigning to it inside a conditionally-executed block. Instead, the if/else or try/catch itself returns a value. This contributes to concision, safety, and readability.
It's not correct to say there is no parallelism in virtual thread. There is virtualThreadPerTaskExecutor and structured concurrency support (which is in preview, but haven't changed much) to execute things concurrently. On JVM, you forgot about other major advantages of using virtual threads like better debugging , stack trace, profiling etc.
Thank you for sharing!
Truly excellent talk highlighting the many benefits of Kotlin. Thanks for also going into WebFlux and coroutines towards the end.
Nice video, Happy Kotliner
Gain! Unfortunatelly Kotlin for backend doesn't get enough
15:51 using kotlin data classes as JPA entites is not a good idea.
14:57 Java records now supports derived records (JEP 468)
Kotlins come and go. Java stays forever 😊
Is there any way to call suspend function from a non suspend function? Does it even make sense?
Null to optional 😂 good point that’s a total anti pattern for optional
Kotlin's syntax and concepts are similar with C#, which one comes first😃
Kotlin is much more ergonomic and concise. Over the period of time, C# has become a kitchen sink language.
Someone said that Kotlin is valuable just because it doesn't use semicolons.
I dont understand the trend to make comparison amogn these two languages. Man can make safe and readable code in java & kotlin. All features are now available in both languages, it only differs in what it is called and the usage (for example extension functions you replace with util classes or use bytecode maven plugin for support it dirrectly). This comparision sessions are only for guys liking the smell of their farts (south park if you know :D)
Scala cult, Groovy cult, amd now Kotlin cult
and yet Google ditched the Java cult