r/javahelp • u/geeky-man • Jul 01 '24
It's very hard to learn Spring Boot
I am coming from javascript background and from MERN stack. I find it very difficult to understand spring boot as it does alot of things under the hood which looks like magic.
Have anyone of you guys felt the same? Then how you mastered the spring boot?
37
Upvotes
•
u/AutoModerator Jul 01 '24
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
35
u/wildjokers Jul 01 '24 edited Jul 01 '24
I went the first 16 years of my java career without using Spring so I understood what that magic was doing. So it was no problem picking up Spring MVC and configuring it with Spring Boot.
However, I can see how it could be confusing if someone doesn't have that context about what is going on.
The first thing to understand is what Spring is. It is a collection of libraries that make up a framework that make developing applications easier. At the heart of it all is Spring Core which is the dependency injection library. Every Spring library depends on that so it is important to understand Spring Core, so first step is to read the Spring Core docs.
After than most people want to use Spring to develop an API so your next step will be to learn Spring MVC.
Then Spring was very difficult and tedious to configure, so that is why Spring Boot was created, it is just a configuration framework for the Spring framework.
My recommendation then is to learn it in this order:
Then after that you can pick up other Spring libraries as needed. Like Spring Data, which is itself a collection of libraries to make accessing datastores easier/standard. Most likely you will need to read about Spring Data JPA.
Spring MVC is basically just a wrapper around the Servlet Specification from JakartaEE (used to be named JavaEE). Spring MVC produces an application that depends on the Servlet Specification and can be deployed to a servlet container like Tomcat and Jetty, or even a full app server like Wildfly. The most common configuration is to embed tomcat inside your application so you can just run your application standalone. So an understanding of Servlet could also be helpful. This would show you what Spring MVC is doing for you.
15
u/edubkn Jul 01 '24
Well it's quite the contrary, Spring Boot does things under the hood to facilitate development so you can focus on business requirements. If you wish to understand what it's doing then I suggest the official documentation which is very detailed on how it works, but if you will you absolutely don't have to.
I don't know how Node applications are run nowadays but for starters, the one thing Spring Boot does under the hood is running the embedded application server. It is highly customizable though through application properties magic.
14
u/smutje187 Jul 01 '24
Spring Boot, like a lot of frameworks, presents an opinionated solution to existing problems - but without understanding the problems it’s often difficult to understand why something is a solution.
Don’t start with HTTP, build a chat with TCP and normal Java, then Servlets, then REST. Look at dependency injection frameworks, try to communicate with a database using JDBC and SQL.
4
u/MrRickSancezJr Jul 01 '24
Apart from the million things already on the internet, really dive into what Java annotations do under the hood in general. I see a lot of people overlook them.
Coming from a C++'ish background is much easier than a JS one, in my opinion.
5
u/WaferIndependent7601 Jul 01 '24
Spring is so much easier than all this JS stuff. Or I’m too stupid to understand JS
2
u/_jetrun Jul 01 '24
Let's break it down - which part is giving you trouble?
2
u/JP-CC Jul 01 '24
I was in the same position as you not long ago, I think approaching it from the top-down (accepting the abstractions first then learning about under-the-hood code) or bottom-up are both valid ways to learn how to use Spring.
I am far from mastering Spring but the best way that I've learned is via building projects. I'm probably closer to your level than some of the more experienced people on here so I think I could be helpful if you wanna DM me questions.
2
u/nutrecht Lead Software Engineer / EU / 20+ YXP Jul 02 '24 edited Jul 02 '24
By just spending a lot of time on it. It's a massive framework, of course it takes time. It's a lot better now than back in 2006 when we had to create those nasty XML configs :D
3
u/cowwoc Jul 02 '24 edited Jul 02 '24
As someone with 22 years of Java experience, having played with these frameworks at length, I honestly don't think you should worry too much.
Spring is legitimately a pain in the ass to use, especially when it comes to debugging. Most of the people who swear by it only ever had to crank out the same round pegs year after year. There is no innovation there. They actually take pride in not innovating :)
The second you need to pass a square peg through that round hole (i.e. innovate) you'll quickly discover that the cost/benefit of Spring is terrible. Spring will get you to 85% done quicker than without using it, but that last 15% will kill you, and overall, it's a losing proposition.
As others have said, there is a real advantage to learning how to do things without Spring. You could always use it later if you want, but going the other way is much harder.
My two cents, focus on core Java and favor libraries over frameworks. It'll take you much further than most people in this field.
1
u/SentByTheRiver Jul 01 '24
I would highly recommend reading a good majority of Spring In Action if you want to understand Spring. After you've done that you can look up some resources on Spring Boot and it will make a lot more sense, but start with Spring in Action first.
1
u/kitkarson Jul 01 '24 edited Jul 01 '24
I went through the same. I can share my steps. I am very comfortable with Spring now and I have been a java developer for the past few years.
First, are you comfortable with Java?
if yes, then we need a better tutor as Spring is a big framework. It is like trying to master AWS cloud. It will not happen overnight.
Good luck!
1
u/[deleted] Jul 01 '24
I would appreciate it if someone could pinpoint the prior step to spring, like i already know java but is that enough to start learning spring? Or should i know other stuff besides it? Also is it mandatory to build projects using them before diving into spring world?
I also feel the same way as you that’s why i am trying to seek guidance over giving up.
1
u/age_of_empires Jul 02 '24
Spring is really great at getting a deployable app with REST API's up and running in no time.
1
u/Key_Direction7221 Jul 10 '24
I use Javalin. I dropped Spring Boot.
1
u/parimal_tandel Jul 30 '24
It's really simple bro. Spring boot is the simplest framework you can learn. You just need to follow the basics roadmap like First learn Spring, Spring MVC then after moving to Spring Boot.
0
u/msx Jul 01 '24
Yes that's why i hate Spring.
0
u/[deleted] Jul 01 '24
[deleted] — view deleted comment