r/learnjava • • Dec 12 '20

[ASK] How to Learn Java Spring?

I have a background in backend development using Python Django, but now I have to use Java Spring. I can do programming in Java but haven't used Spring.

But the problem is there are so many Java Spring framework like Hibernate, Security, MVC, etc. In addition, I also see that we have to define our ORM implementation like how to make the SQL query, etc. I haven't done anything like that because in Python Django the ORM implementation has been made by the framework.

I would like to learn how to make a REST API as most of the backend job required this for Junior Engineer (Fresh Graduate), how do I start? do I need to learn all java spring framework?

78 Upvotes

46 comments sorted by

View all comments

5

u/Kolibreeze Dec 12 '20

What really tripped me up in the beginning was the not knowing that there is: A Spring, using mostly XMl, and B Spring Boot, using mostly annotations.

Both are part of Spring, with Spring Boot being the newest, most used. But knowing this can make life a lot easier when googling.

Also, to learn, i'd advise to check out spring initializer to easily set up a project; https://start.spring.io/. (Definitely make sure to scroll through the dependencies so you can see what's out there).

Then, pick a project which uses a database, e.g. like creating a list of books read and books to read, a game library with your reviews or something similar, and then just start.

Oh, protip, start small and use a H2 in memory database. If you've got this working, you can always implement another one.

1

u/slowfly1st Dec 14 '20

What really tripped me up in the beginning was the not knowing that there is: A Spring, using mostly XMl, and B Spring Boot, using mostly annotations.

"A) Spring" doesn't use mostly XML. It's up to you, what you want to use, see for instance

org.springframework.context.annotation.Configuration

 * Indicates that a class declares one or more {@link Bean @Bean} methods and
 * may be processed by the Spring container to generate bean definitions and
 * service requests for those beans at runtime, for example:
 *
 * <pre class="code">
 * &#064;Configuration
 * public class AppConfig {
 *
 *     &#064;Bean
 *     public MyBean myBean() {
 *         // instantiate, configure and return bean ...
 *     }
 * }</pre>

1

u/Kolibreeze Dec 14 '20

Yeah, mostly might not have been best the choice of words.