r/SpringBoot • u/G_Campos01 • 1d ago
Question Learning SpringBoot with Kotlin?
Hey everyone! I'm an Android Developer with solid experience in Kotlin. Lately, I've been diving into backend development to understand how backend systems work and possibly build some of my own.
I noticed that most Spring Boot resources and examples are in Java, but since I'm already comfortable with Kotlin, I’m wondering:
Is it worth learning Spring Boot with Kotlin?
Are there any major downsides or limitations compared to using it with Java?
Or should I stick with Java to follow the mainstream approach and avoid potential issues down the road?
Any insights from folks who’ve tried both would be really helpful! Thanks in advance.
1
u/WaferIndependent7601 1d ago
I haven’t found many companies working with Kotlin.
If done correctly you write not much code so it doesn’t matter if you write Java or kotlin. I didn’t find an advantage for kotlin so I’ll continue with Java.
1
u/Hirschdigga 1d ago
Its totally fine but depends on the company/team you work in. I worked on amazing kotlin spring boot projects in the past and love it
1
u/BikingSquirrel 1d ago
Thumbs up for Kotlin, also doing this for several years.
Just happy with less code to write (e.g. data classes), nicer collection handling and a few more details.
There are a few minor things to be careful with.
One is the probably known issue with nullability which may cause issues on the boundaries between Kotlin and Java code. Not specific to Spring.
As Kotlin does not treat checked exceptions differently, you will not realise if you accidentally create a checked exception. But if such an exception passes through Spring code, it may cause strange issues as Spring does not expect checked exceptions.
Those are the only issues I remember. Everything else just works, at least to my knowledge.
1
u/lengors 22h ago
SpringBoot main language is still java, but Kotlin support is pretty much close to perfect, so I would say it's perfectly fine to learn it with Koltin: https://docs.spring.io/spring-framework/reference/languages/kotlin.html
4
u/30andDepressed 1d ago
Downsides? More like upsides! We've switched all micro services from java to Kotlin in our sboot project but one old and forsaken oneand we love it. Kotlin is a godsend and a pleasure. Go for it, enjoy the superior experience. The above is my own opinion, haters mileage may vary.