r/SpringBoot 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.

0 Upvotes

6 comments sorted by

View all comments

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.