One of compelling reasons behind avoiding @Autowired annotation and favouring constructor injection is that it makes class dependencies quite explicit. This also makes class to be tested independently with required dependencies. This is not hard and fast rule though - you prefer constructor injection for mandatory dependencies that is; without them class can not be instantiated (and tested independently) and hence ensure proper functioning at runtime (by satisfying all required dependencies at class instantiation time) and go for @Autowired for optional dependencies. Also, segregating classes into respective packages w.r.t. functionality e.g. controller, service etc is not, by definition, modular. It can be attributed to layered structuring (and possibly imply adaptation of layered architecture). While using actuator or spring security, it make sense (and pays) to do common baseline configuration across services and allow/hide sensitive end points. Great content overall!! kudos!
As usual, You are forerunner and pioneer in Tech Stack. I am convinced all the points. Most impressive and key takeaways is don't use Autowired which I did frequently. You asked to use constructor injection instead of Autowired. You explained the implications as well. Awesome buddy !!! Keep rocking !!!
Its a trade off. Mostly it depends on the products your company uses already. Keycloack is open source. JWT will go hand in hand with okta and keycloack
Thanks for the useful pointers. Can you please shed some light on the ramification of using lazy initialization in production and the impact of it on the performance in terms of response time? Few spring blogs advised against using lazy initialization in production with apprehension of poor performance at run time during serving requests or serving requests at scale. I would like to request your expert opinion around this. Also if possible , can you please share your recommendation around Functional Bean Registration vs Traditional Bean Registration to improve cold start of SB applications
Thank you @Tech Primers that was helpful. Instead of @autowire , current we use lombok @allargsconstructor or required or... which one you feel better?
Yes you can use lombok. However if the class grows huge, constructor injection will reveal it so that you can break down the class. Lombok doesn't raise those red flags
Hi sir, nice video. i have a doubt sir like performance wise, using our old application servers like websphere etc works well? or deploying the spring boot apps to cloud with loadbalancers and extra configuraitons work well? apart from pricing etc. when we used to deploy monolothic applications including struts+ejb+db applications to application servers not faced much performance issues but with the embedded tomcats with more jvm's getting the performance issues....
That's where you need to see what changed from your old app. May be there are code which are bringing things down. Or there could be capacity issues with jvm.
For any pipeline which is bases on github jenkins kubernetes, if i want to migrate or clone same type of pipeline using Bitbucket , so can i do it by changing repository URL of Bitbucket or what changes are required
I'm not a fan of AOP since it does stuff based on reflection and i have seen apps underperforming to log messages. If your app is small then you can go with AOP.
Where code review is done for spring boot applications in IDE or repository and also before pushing code to repository or after pushing code to repository
Can you please explain more on reactive. Especially in what scenarios we can use reactive programs in spring boot micro service 2) I have heard if you use reactive then from end to end all your tech stack should be reactive. Like your db also should be reactive 3) in my above case we cannot use reactive other than db operation? If not pls give us an example or pointers and some use cases
How its possible to review code in repository...means in IDE we get what bugs we are getting and run test cases but after creating pull request how exactly code is analysed or reviewed without IDE in repository?
Do you have a full-fledged course on Spring framework? I have watched some of your videos and they are great. If you have one - can you point me to it please? Thanks
If possible, We would like to see each best practice with an example. Thanks you very much for your valuable time and content you are providing to us without any charges.
Agree Azhar. I have seen people exposing different Data model because database could be legacy, following different field names, etc. Hence exposing DTOs with API contracts following standards are a good practice to abstract tech debts behind entities
In spring batch processing jobs what are sources for files which we want to process in end of day daily or monthly basis like from emails, databases, datawarehouse or from where files are sourced for batch processing
As usual good one Ajay, you always bring good content to larger audience, Loved to watch your videos. It would be great if you make part2 of this video by adding examples, at least from the step 7 to 15 :)
That's a lot of really great info, well structured and well explained. Worth the time. Love your work. Will definitely share with friends. Thank you🌹, keep up the good work bro. [Off topic] : Are you from Kerala?
Again amazing content ... Thanks really appreciate.. can you make a video on how to debug spring boot application using intellij debugging tool .. thanks in advance..
@@TechPrimers I have also requested that you help us or show us how we can create similar video turorial introduction animations you have on your RUclips video Tutorials.
but I thought liveness or readiness has nothing to do with Scalability, Liveness or readiness may help in triggering restart a pod in case if anything goes wrong.
Yes. But when your app scales, we need to know when the app is ready to serve traffic. That's when readiness probes help to create seamless scalability
@@TechPrimers As we are struggling to find out what impact our springboot service performance... your suggestions to avoid performance issues on service... for example services are not responding suddenly , but if we restart server its worked,it might be because of request memory exceeds the limit which we defined in k8 config file...
@@TechPrimers or please make a video on best practices to use K8 in spring boot... maximum most of the performance issue will resolve through best practices to use the K8...it will be useful to all of us...
Most of these are standard coding, design spring framework practices rather than spring boot specific. Would have been more helpful if the focus was on spring boot features. Good video though.
Examples/implementations
=======================
🔗 Spring Initializer - ruclips.net/video/_ckyhzJiTEk/видео.html
🔗. Open API Specification - ruclips.net/video/TNJf9kPcoh4/видео.html
🔗. AutoConfiguration, Constructor Inject, Modular packages, 6. DTO - ruclips.net/video/eYfopvusG_s/видео.html
🔗 Logging standards - ruclips.net/video/gPKJkY2t7Pc/видео.html & ruclips.net/video/HBLSsuvRYss/видео.html
🔗. Health Check actuators - ruclips.net/video/im3h-PbvjU0/видео.html
🔗. Testing - ruclips.net/video/8S8o46avgAw/видео.html
🔗. Faster boot up - lazy initialization - ruclips.net/video/5SgvEbb6DKs/видео.html
🔗. Faster boot up - Spring Native - ruclips.net/video/YeNLr0C94as/видео.html
🔗. Reactive Programming - ruclips.net/video/WeMPkxGXXaM/видео.html
One of compelling reasons behind avoiding @Autowired annotation and favouring constructor injection is that it makes class dependencies quite explicit. This also makes class to be tested independently with required dependencies. This is not hard and fast rule though - you prefer constructor injection for mandatory dependencies that is; without them class can not be instantiated (and tested independently) and hence ensure proper functioning at runtime (by satisfying all required dependencies at class instantiation time) and go for @Autowired for optional dependencies.
Also, segregating classes into respective packages w.r.t. functionality e.g. controller, service etc is not, by definition, modular. It can be attributed to layered structuring (and possibly imply adaptation of layered architecture).
While using actuator or spring security, it make sense (and pays) to do common baseline configuration across services and allow/hide sensitive end points.
Great content overall!! kudos!
Thanks for the detailed explanation Amit
It really feels nice when you explain the things by being in front of the camera :) waiting to learn more and more things from the Guru
All this while, I never knows this channel is yours. Learnt many things from this channel... Keep going. Great working with you
Cool. Thanks chandan 🙂
As usual, You are forerunner and pioneer in Tech Stack. I am convinced all the points. Most impressive and key takeaways is don't use Autowired which I did frequently. You asked to use constructor injection instead of Autowired. You explained the implications as well. Awesome buddy !!! Keep rocking !!!
Cheers Gnana. Glad it's helpful
I got placed with superb package, ur videos helped a lot, Thankyou so much Guru
Glad to know Manideep. Thanks for remembering to share it with me.
Congrats and all the best on your role. ✌
Thanks to share your knowledge and activate subtitles
Great video to ensure we are following all the best practices. These best practices video are really great. Thanks a lot sir!
Thank you so much, would love to see a serie detailing each best practice 🙏🏻
Most of them are already there in the channel.
@@TechPrimers great then, will check that ! Thanks a lot and keep up the great work
here are the implementations
Examples/implementations
=======================
🔗 Spring Initializer - ruclips.net/video/_ckyhzJiTEk/видео.html
🔗. Open API Specification - ruclips.net/video/TNJf9kPcoh4/видео.html
🔗. AutoConfiguration, Constructor Inject, Modular packages, 6. DTO - ruclips.net/video/eYfopvusG_s/видео.html
🔗 Logging standards - ruclips.net/video/gPKJkY2t7Pc/видео.html & ruclips.net/video/HBLSsuvRYss/видео.html
🔗. Health Check actuators - ruclips.net/video/im3h-PbvjU0/видео.html
🔗. Testing - ruclips.net/video/8S8o46avgAw/видео.html
🔗. Faster boot up - lazy initialization - ruclips.net/video/5SgvEbb6DKs/видео.html
🔗. Faster boot up - Spring Native - ruclips.net/video/YeNLr0C94as/видео.html
🔗. Reactive Programming - ruclips.net/video/WeMPkxGXXaM/видео.html
Which is mostly used to secure spring boot applications Keyclock, OKTA or JWT or how its decided which one to use to secure rest api and application
Its a trade off. Mostly it depends on the products your company uses already. Keycloack is open source. JWT will go hand in hand with okta and keycloack
I also follow these concept. Best video
This video is absolutely helpful even for an interview.
I bet 😁
Thanks for the useful pointers. Can you please shed some light on the ramification of using lazy initialization in production and the impact of it on the performance in terms of response time? Few spring blogs advised against using lazy initialization in production with apprehension of poor performance at run time during serving requests or serving requests at scale. I would like to request your expert opinion around this. Also if possible , can you please share your recommendation around Functional Bean Registration vs Traditional Bean Registration to improve cold start of SB applications
Sure. Sounds like a great idea for next video. Will do it buddy. Thanks
Thanks for this one. We are following majority of the best practices!
Good to know Nishanth.
Thank you @Tech Primers that was helpful.
Instead of @autowire , current we use lombok @allargsconstructor or required or... which one you feel better?
Yes you can use lombok. However if the class grows huge, constructor injection will reveal it so that you can break down the class. Lombok doesn't raise those red flags
Hi, Would be great if you could provide a session on how to send metrics from springboot to ElasticSearch
Could you please put videos to review spring boot code?
Can you please give the example of each or link from your previous upload. It would be more elaborative in that sense.
It's in the description Wieko
@@TechPrimers Thanks!
Hi sir, nice video.
i have a doubt sir like performance wise, using our old application servers like websphere etc works well? or deploying the spring boot apps to
cloud with loadbalancers and extra configuraitons work well?
apart from pricing etc. when we used to deploy monolothic applications including struts+ejb+db applications to application servers not faced much
performance issues but with the embedded tomcats with more jvm's getting the performance issues....
That's where you need to see what changed from your old app. May be there are code which are bringing things down. Or there could be capacity issues with jvm.
For any pipeline which is bases on github jenkins kubernetes, if i want to migrate or clone same type of pipeline using Bitbucket , so can i do it by changing repository URL of Bitbucket or what changes are required
How about using AOP for logging?
I'm not a fan of AOP since it does stuff based on reflection and i have seen apps underperforming to log messages. If your app is small then you can go with AOP.
@@TechPrimers Isn't logging supposed to be async? atleast log4j2 is if I am not wrong
Thanks, Surely really good tips for Spring developers
Thank you javier. Cheers
Where code review is done for spring boot applications in IDE or repository and also before pushing code to repository or after pushing code to repository
It should be in the repository. Take a look at my bitbucket video
Can you please explain more on reactive. Especially in what scenarios we can use reactive programs in spring boot micro service
2) I have heard if you use reactive then from end to end all your tech stack should be reactive. Like your db also should be reactive
3) in my above case we cannot use reactive other than db operation? If not pls give us an example or pointers and some use cases
Sure shabarish will do
I would also be interested to know more about what you mean by reactive.
How its possible to review code in repository...means in IDE we get what bugs we are getting and run test cases but after creating pull request how exactly code is analysed or reviewed without IDE in repository?
It depends on the reviewer. Some ppl checkout the branch locally to see the changes however the diffs should help access the impact.
Even though I don't like Java. Your explanation on spring boot made it easier to understand.
Do you have a full-fledged course on Spring framework? I have watched some of your videos and they are great. If you have one - can you point me to it please?
Thanks
If possible, We would like to see each best practice with an example.
Thanks you very much for your valuable time and content you are providing to us without any charges.
Those videos are already there. I will try to link them in description
here is the list sachin
Examples/implementations
=======================
🔗 Spring Initializer - ruclips.net/video/_ckyhzJiTEk/видео.html
🔗. Open API Specification - ruclips.net/video/TNJf9kPcoh4/видео.html
🔗. AutoConfiguration, Constructor Inject, Modular packages, 6. DTO - ruclips.net/video/eYfopvusG_s/видео.html
🔗 Logging standards - ruclips.net/video/gPKJkY2t7Pc/видео.html & ruclips.net/video/HBLSsuvRYss/видео.html
🔗. Health Check actuators - ruclips.net/video/im3h-PbvjU0/видео.html
🔗. Testing - ruclips.net/video/8S8o46avgAw/видео.html
🔗. Faster boot up - lazy initialization - ruclips.net/video/5SgvEbb6DKs/видео.html
🔗. Faster boot up - Spring Native - ruclips.net/video/YeNLr0C94as/видео.html
🔗. Reactive Programming - ruclips.net/video/WeMPkxGXXaM/видео.html
@@TechPrimers thank you very much, sir
@@TechPrimers Thanks Much! ... this is what i was looking for
If we have Entities then why we need DTOs ? Until unless we needed for specific purpose we shouldn't go for DTA right?
Agree Azhar. I have seen people exposing different Data model because database could be legacy, following different field names, etc. Hence exposing DTOs with API contracts following standards are a good practice to abstract tech debts behind entities
Wow excellent presentation thanks for sharing 👌🙏
In spring batch processing jobs what are sources for files which we want to process in end of day daily or monthly basis like from emails, databases, datawarehouse or from where files are sourced for batch processing
This question should be addressed to your team mates Shubham. It depends on what systems you are connecting to.
awesome and very interesting continue
please make videos on clean architecture for springboot microservices api. most of the production grade application are built using clean architecture
Nice Explanation
As usual good one Ajay, you always bring good content to larger audience, Loved to watch your videos. It would be great if you make part2 of this video by adding examples, at least from the step 7 to 15 :)
Sure. Some of them are already there suresh. You can check them in the channel
@@TechPrimers okay Ajay. thanks again :)
That's a lot of really great info, well structured and well explained.
Worth the time. Love your work. Will definitely share with friends.
Thank you🌹, keep up the good work bro.
[Off topic] : Are you from Kerala?
Thank you. Glad it's helpful sreedarsha.
I'm from Chennai
Precise and nice.
Thanks bud. Cheers
Aah, the ACG tee-shirt! 🙌
#Swags
Can you say is lambok is really useful .. Is it is plugin or dependency .. I have always issue with lambok project..
I have a video on lombok - ruclips.net/video/YSFVsbaPIEc/видео.html
To me, its useful for code generation. We dont have to write lot of pojos
Again amazing content ... Thanks really appreciate.. can you make a video on how to debug spring boot application using intellij debugging tool .. thanks in advance..
It's already there in the channel. Check it here ruclips.net/video/jA1wHbAK_T0/видео.html
@@TechPrimers Thanks man you are amazing!
Cheers bud
Can you please do your setup tour video, showing your setup.
Your workstation
I have that in my Instagram page. Take a look there
@@TechPrimers I have also requested that you help us or show us how we can create similar video turorial introduction animations you have on your RUclips video Tutorials.
Plz make video on knative with spring Boot
Sure vikram
@@TechPrimers Thanks 😊
but I thought liveness or readiness has nothing to do with Scalability, Liveness or readiness may help in triggering restart a pod in case if anything goes wrong.
for scalability we have HorizontalPodAutoscaler object
Yes. But when your app scales, we need to know when the app is ready to serve traffic. That's when readiness probes help to create seamless scalability
Hi,
Please make video on performance issue on springboot and how to resolve,it will be useful to us.
Sure Karthick. Any specific performance aspect are you looking at?
@@TechPrimers As we are struggling to find out what impact our springboot service performance... your suggestions to avoid performance issues on service... for example services are not responding suddenly , but if we restart server its worked,it might be because of request memory exceeds the limit which we defined in k8 config file...
@@TechPrimers or please make a video on best practices to use K8 in spring boot... maximum most of the performance issue will resolve through best practices to use the K8...it will be useful to all of us...
sure Karthik. Good topic. Will do that soon.
@@TechPrimers Thank you very much... you are great ...😊
Authentication and authorisation... monitoring and centralized logging
Dont they default to having them these days. 😀
Thanks for adding them D.
good one👍🏼
Thank you so much ❤️
An example of a piece of code would've been nice ☺
Thank you
Awesome !
Loved it, but you could have added some examples.
Its in the description Ashish
Well, @Autowired is not even recommended by Spring itself.
If you are using lombok, then use @RequiredArgsConstructor and make the field private final
Good, but should have code examples, maybe broke it in a series of videos
I have those videos linked in the description Eduardo. Take a look at them.
@@TechPrimers Great, I will take a look, thank you
Most of these are standard coding, design spring framework practices rather than spring boot specific. Would have been more helpful if the focus was on spring boot features. Good video though.
you could have showed some code
Apologies ozzy, missed it. However i have example references in the description
👍
showing more examples would have been better rather than news reading
Check description for those videos
Nothing new
Which denotes you are already following best practices Mahesh 🙂
@@TechPrimers Sorry, I am big fan of your content following you for long time.