r/learnjava • • Mar 21 '21

Learning backend development

I have more than 6 years of experience with working in Java and 2 years in kotlin as I mostly work on android professionally, I had done a course on udemy for spring boot and understood what's happening but there was a gap where spring boot seemed like a black box where you annotate and work is done by spring, can some suggest a way to learn backend where I learn fundamentals and how things work rather some magical annotations. I am open to online courses, books, blogs whatever I can get my hands on to learn the fundamental and how things work under the hood in spring.

Any help is appreciated, thank you.

42 Upvotes

16 comments sorted by

View all comments

8

u/Alex0589 Mar 21 '21

As of now, backend java is divided in two categories:

  • Frameworks that follow the JAX-RS specification(JakartaEE Web Services)

  • Frameworks that don't follow the JAX-RS specification

There are obviously more standards, but to make this comparison easier I'm going to only consider Jaxrs.

In the first category there are frameworks like:

  • Quarkus

  • RestEasy

  • Jersey

  • Helidon

In the second category, on the other hand, there are:

  • Vert.x

  • Spring

  • ...

Considering that JAX-RS is a specification, if you learn its annotations and classes you will be able to use a ton of frameworks without having to learn anything new. That's why standards are so great. If that's the path that you what to take, the documentation for jakartaee is a great place to start(https://jakarta.ee/specifications/restful-ws/). Once you are done leering the specification, the framework I advice using is Quarkus . Most modern backend frameworks for java also integrate nicely with Graal, a polyglot vm developed by Oracle. This is because it allows to natively compile your Java application, improving performance quite drastically.

If you instead prefer Spring or Vert.x, their documentation is also spot on and both provide starting guides for beginners.

In my opinion, the first option is the best, also considering that Quarkus is considerably faster than Spring, even when both are running in native mode using graal. A detailed comparison can be found here

2

u/[deleted] Mar 21 '21

I got what you are saying but what I am looking for is to learn how to do it without frameworks so that I can better understand what the magic annotation is doing, I want to know the pain point this frameworks are trying to solve so that I can appreciate/better understand the working of framework irrespective of framework I chose later on

6

u/[deleted] Mar 21 '21

I like this attitude, but you're in for some fun haha. In this case, you want servlets. The java servlets API is what takes in HTTP requests and returns responses. Being able to write an application using pure servlets and deploying it to an application server like tomcat will teach you all the nuts and bolts under the hood.

Learn how to make requests using multiple HTTP methods and urls. Send payloads in XML, JSON, and x-form-urlencoded, and send back responses in all of them as well.

Then, when you're done being a masochist, learn jersey or spring.

1

u/HecknChonker Mar 21 '21

This is the best answer by far.

1

u/MaltePetersen Mar 21 '21

Before that I would suggest to search an article which shows how to build a simple dependency injection container yourself. This explains a lot spring magic on its own because you come into contact with the reflection api. After that playing around with the servlet api will give a full fledged idea how stuff works

1

u/Alex0589 Mar 22 '21

Jersey and spring are way slower, more resource intensive and produce bigger executables compared to Quarkus, it just doesn't make sense to learn them. Obviously, this is assuming that you are not looking for something that's going to give you a job in the smallest time frame possible

1

u/Alex0589 Mar 22 '21

If you really want to, you can implement your own thing using barebone servlets. Just know that it's the most masochist thing you do.