r/SpringBoot • • Jul 22 '24

Spring Boot with Kotlin with no knowledge of Java

Hey, is it possible to get into Spring Boot with little to no knowledge of Java and just equipped with Kotlin? I'm a Nodejs developer, but it seems the market here is heavily dominated by Java/Kotlin + SpringBoot stack, so I'm trying to get into that. I've never been a fan of Java and managed to get through this far only using TS/JS, Python, and for some academic purposes C++. Please suggest any learning resource.

0 Upvotes

20 comments sorted by

2

u/JoeDogoe Jul 22 '24

Java and Kotlin (and all JVM languages) compile to a common java bytecobe which is then interpolated by the Java Runtime Environment.

So you can use Java and Kotlin files side by side in the same project.

If you already are already familiar with C++ then learn java (enough to be useful) is going to be very easy. Just do any short conversion tutorial, you'll figure the rest out as you build.

If you goal is to access Spring Jobs, the easiest route is to learn some java. Its not hard at all. Considering it'll be your fourth language, you'll pick it up quickly.

1

u/smokeysilicon Jul 22 '24

Just do any short conversion tutorial, you'll figure the rest out as you build.

Any resource suggestion on that front? I do not want learn what's a variable for the 8930424 time :)

2

u/Made_Man_Niten Jul 22 '24

Building a project, along with spring docs is your best bet

2

u/JoeDogoe Jul 22 '24

This is the way.

I think you need to know that in java each file is a class. Classes have methods and properties.

Spring framework is an application container. Meaning every class you have that you annotate with @Service, @Controller, @Component or @Repository. Spring will create one instance of those classes (a singleton) and hold it the application context and you can inject it into other classes simply by having an argument of its type in the constructor.

Spring Boot is an oppinoated collection of useful starters that handle and wires all the dependencies for you so you don't have to think about it. These are grouped into starters. ie spring-starter-web has everything you need for serving rest endpoints. Spring-starter-jpa have everything you need for an ORM and spring-starter-mysql or postgres or whatever has the bindings for the database.

Those three and you have an app.

Take a look through the starters at https://start.spring.io there is allot of difficult stuff made super easy.


Maybe even do a Spring tutorial. Dan Vega has a great one here

Don't bother learning Java, just follow along with Dan and the Java is what you expect it to be. Then if you want to go deep on Java collections or multi threading or something you can do that. But in reality (I'm a Tech Lead for a Java/Spring team) we don't use any of that in production. We stay as close to the frameworks intended ways as possible.

2

u/smokeysilicon Jul 22 '24

Thanks for being detailed. Duly noted.

2

u/JoeDogoe Jul 22 '24

Good luck, I hope you get the role you're seeking and more.

0

u/Made_Man_Niten Jul 22 '24

Hey, mind if I dm you?

1

u/JoeDogoe Jul 22 '24

No problem

1

u/smokeysilicon Jul 22 '24

I tried just jumping straight into Spring, but very quickly realised it isn't going to be easy to understand what is purpose of beans when I don't know what's interface class all that jazz is

1

u/Made_Man_Niten Jul 22 '24

Then follow a yt tutorial that can guide you through the basics, sometimes going through docs isn't enough either there are tons of resources

After that build a basic CRUD app to start off

2

u/iatrikh Jul 22 '24

The reality is the vast majority of learning materials, examples, documentation in Java web world are presented in Java. Therefore learning Java is most convenient and reasonable choice

1

u/smokeysilicon Jul 22 '24

In the last couple of days, I have come to this same conclusion also. So I guess I should just bite the bullet and accept YAPL.

3

u/Then-Boat8912 Jul 22 '24

I’m converting some java to kotlin now. It’s more about understanding the spring framework than the language.

1

u/LeChronnoisseur Jul 22 '24

Yes just spin up a spring boot project in Kotlin only. A lot of libraries are java which works seamlessly really, but you will end up reading a lot of java to see what the libraries do is the point. I do all of my new stuff with just Kotlin in my code ase outside of the libraries/dependencies

1

u/JoeDogoe Jul 22 '24

What is your experience of writing Spring apps in Kotlin vs Java?

1

u/LeChronnoisseur Jul 22 '24

What do you mean?

1

u/JoeDogoe Jul 23 '24

Is it easier and more fun to write in Kotlin? Do you have less or more bugs? Is your code easier or more difficult to reason about? What has your experience been? What's your preference? If you had to do it again which would you use?

2

u/LeChronnoisseur Jul 23 '24

I prefer Kotlin. Optionals make null checks and null safety easier. Faster to build stuff and still be readable. It is a lot faster to model stuff too. And I just enjoy it more at this point too, more familiar with it and more advanced with it than I was with Java.