Since Kotlin is simply a dependency and plugin for Maven (that's it!). It's such a nice, compact, easy-to-grok language that removes all the syntactic fat (opposed to syntactic sugar) that Java provides.
From 5.0.0 onward, Kotlin has first-class support from Spring, which effectively means it has all the same guarantees as Java in terms of code working correctly.
Kotlin itself has a ton of interoperability features to smoothly integrate with any already existing Java library, which means you have the same freedom of choice.
Kotlin's Java interop is amazing, and was by no means an afterthought by JetBrains. Thus Kotlin works nicely with Spring, which provides a lot of the boilerplate functionality for web applications, especially Spring Boot.
These are some points which you already mentioned but I will still have a say about it. Kotlin has a much more compact syntax and its type system allows for much more robust code through null-safety, sealed classes, and immutable/mutable collection distinction, which together significantly reduce development time on any project.
Answer from Tahir Hussain Mir on Stack OverflowSince Kotlin is simply a dependency and plugin for Maven (that's it!). It's such a nice, compact, easy-to-grok language that removes all the syntactic fat (opposed to syntactic sugar) that Java provides.
From 5.0.0 onward, Kotlin has first-class support from Spring, which effectively means it has all the same guarantees as Java in terms of code working correctly.
Kotlin itself has a ton of interoperability features to smoothly integrate with any already existing Java library, which means you have the same freedom of choice.
Kotlin's Java interop is amazing, and was by no means an afterthought by JetBrains. Thus Kotlin works nicely with Spring, which provides a lot of the boilerplate functionality for web applications, especially Spring Boot.
These are some points which you already mentioned but I will still have a say about it. Kotlin has a much more compact syntax and its type system allows for much more robust code through null-safety, sealed classes, and immutable/mutable collection distinction, which together significantly reduce development time on any project.
The main difference is: with Kotlin, you're programming in Kotlin...with Java, you're programming in Java. Spring makes use of some language features exclusive to Kotlin to streamline certain operations, but I wouldn't think you'd want to choose one language over the other just because of those few additional benefits. For the most part, there is no difference. Spring supports both languages well.
UPDATE: I guess I should add that Kotlin does introduce a few minor problems into the whole Spring thing, just because Spring is actually written in Java and was originally designed to be utilized via Java. But just like the pros you get with Spring and Kotlin, these minor negatives should likewise not dictate your choice as to which language to use.
I think what you should be asking is "which language should I use?" leaving Spring out of it. My company is coding new modules in Kotlin because we consider it a significantly better language than Java. But we have lots of legacy Java code, and we've chosen to for the most part not mix languages within a single module, so we still code in Java too. You have to make your own decision. Decide what language you want to program in based on the language itself, and on your existing codebase, but not on how Spring works with it. Spring will work great with either.
There are many articles and blogs out there comparing the two languages, listing their relative pros and cons. I'd suggest that you read everything you can. There's no "right" answer here. (...which is why I know this question is going to be closed as being opinion-based). Try Kotlin. Heck, try Groovy and Scala too. "live" the pros and cons for yourself, and then decide what will work best for you.
BTW, you list "Risk to have Java moving faster than Kotlin" as a Con of Kotlin. I think the risk is in the other direction. Java moves very slowly compared to Kotlin and other alternative languages. That's why you see it playing catch-up...finally introducing features into the language that have been in the alternative languages for many years.
Does Spring Boot work with Kotlin?
Which one is better, Java or Kotlin?
For those who have tried, or are actively working with kotlin instead of Java, how do you compare the development experience? Like... if I were to suggest at my workplace to integrate kotlin one step at a time, or even start the next microservice from scratch with kotlin, what would the benefits and hurdles be? Does it support jdk 21 yet?
Like.. how do things like coroutines or closures blend in? is there a real benefit to use data classes over java records? Is the null safety actually useful?
Hey everyone, I'm a software engineer (I have some experience in java/springboot) considering using Kotlin for a new Spring Boot project. I've heard a lot about its benefits like less boilerplate, null safety, and data classes, but I'm curious about the real-world experience from those who have made the switch.
I'm hoping to get some real insights beyond just the syntax differences. Thanks in advance!
For those of you who had little to no Kotlin experience before, how was the learning curve? What were the biggest "aha!" moments, and what were the most confusing parts? What are some things you wish you knew when you started?
On the flip side, what did you miss about Java?
I'm hoping to get some real insights. Thanks in advance!
Hey everyone,
I’ve been wondering about this for a while. Kotlin today is very well supported by Spring Boot — it’s fully compatible with the Java and Spring ecosystem, provides more features out of the box, reduces boilerplate, and feels cleaner overall.
The Kotlin community has also grown a lot, and the tooling feels very modern and idiomatic. A good example is testing: libraries like Kotest and MockK give you a cleaner, more idiomatic approach compared to the more “traditional” style of testing in Java. Yes, Kotlin tools are often built on top of existing Java ones, but they give you a much nicer developer experience.
So my question is: why would someone still choose to start a brand-new Spring Boot project in Java instead of Kotlin
Would love to hear your thoughts and experiences.
Update: I’m not looking to argue, and I’m not biased — I genuinely just want to ask and hear your answers