15 Spring Boot Best Practices to create Production grade microservices

Поделиться
HTML-код
  • Опубликовано: 24 дек 2024

Комментарии • 115

  • @TechPrimers
    @TechPrimers  3 года назад +9

    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

  • @amitk6701
    @amitk6701 3 года назад +10

    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!

    • @TechPrimers
      @TechPrimers  3 года назад

      Thanks for the detailed explanation Amit

  • @Ravikirankada
    @Ravikirankada 3 года назад +9

    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

  • @chandanbhosle
    @chandanbhosle 3 года назад +5

    All this while, I never knows this channel is yours. Learnt many things from this channel... Keep going. Great working with you

  • @gnanasekaranebinezar7199
    @gnanasekaranebinezar7199 3 года назад +3

    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 !!!

    • @TechPrimers
      @TechPrimers  3 года назад +1

      Cheers Gnana. Glad it's helpful

  • @manideepreddy3710
    @manideepreddy3710 3 года назад +2

    I got placed with superb package, ur videos helped a lot, Thankyou so much Guru

    • @TechPrimers
      @TechPrimers  3 года назад

      Glad to know Manideep. Thanks for remembering to share it with me.
      Congrats and all the best on your role. ✌

  • @compartelo007
    @compartelo007 3 года назад +1

    Thanks to share your knowledge and activate subtitles

  • @amitcenation
    @amitcenation 3 года назад +1

    Great video to ensure we are following all the best practices. These best practices video are really great. Thanks a lot sir!

  • @MrAnasSov
    @MrAnasSov 3 года назад +10

    Thank you so much, would love to see a serie detailing each best practice 🙏🏻

    • @TechPrimers
      @TechPrimers  3 года назад +1

      Most of them are already there in the channel.

    • @MrAnasSov
      @MrAnasSov 3 года назад +1

      @@TechPrimers great then, will check that ! Thanks a lot and keep up the great work

    • @TechPrimers
      @TechPrimers  3 года назад +1

      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

  • @shubhamswaraj1968
    @shubhamswaraj1968 3 года назад +2

    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

    • @TechPrimers
      @TechPrimers  3 года назад

      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

  • @talhaansari5763
    @talhaansari5763 3 года назад +1

    I also follow these concept. Best video

  • @sebas8824
    @sebas8824 3 года назад +1

    This video is absolutely helpful even for an interview.

  • @RideLikeAChamp
    @RideLikeAChamp 3 года назад +3

    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

    • @TechPrimers
      @TechPrimers  3 года назад

      Sure. Sounds like a great idea for next video. Will do it buddy. Thanks

  • @mkbhd2
    @mkbhd2 3 года назад +1

    Thanks for this one. We are following majority of the best practices!

  • @abhilashmuraleedharan4564
    @abhilashmuraleedharan4564 3 года назад +1

    Thank you @Tech Primers that was helpful.
    Instead of @autowire , current we use lombok @allargsconstructor or required or... which one you feel better?

    • @TechPrimers
      @TechPrimers  3 года назад +1

      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

  • @rapurusubbareddy9545
    @rapurusubbareddy9545 3 года назад

    Hi, Would be great if you could provide a session on how to send metrics from springboot to ElasticSearch

  • @Saravanan-lj9so
    @Saravanan-lj9so 3 года назад

    Could you please put videos to review spring boot code?

  • @wiekotamros2634
    @wiekotamros2634 3 года назад +1

    Can you please give the example of each or link from your previous upload. It would be more elaborative in that sense.

  • @sriaya1743
    @sriaya1743 3 года назад +1

    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....

    • @TechPrimers
      @TechPrimers  3 года назад +1

      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.

  • @shubhamswaraj1968
    @shubhamswaraj1968 3 года назад

    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

  • @foruvasanth
    @foruvasanth 3 года назад +1

    How about using AOP for logging?

    • @TechPrimers
      @TechPrimers  3 года назад +2

      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.

    • @foruvasanth
      @foruvasanth 3 года назад

      @@TechPrimers Isn't logging supposed to be async? atleast log4j2 is if I am not wrong

  • @javisartdesign
    @javisartdesign 3 года назад +1

    Thanks, Surely really good tips for Spring developers

  • @shubhamswaraj1968
    @shubhamswaraj1968 3 года назад

    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

    • @TechPrimers
      @TechPrimers  3 года назад

      It should be in the repository. Take a look at my bitbucket video

  • @Virat77799
    @Virat77799 3 года назад +1

    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

    • @TechPrimers
      @TechPrimers  3 года назад

      Sure shabarish will do

    • @scottcurrent9710
      @scottcurrent9710 3 года назад

      I would also be interested to know more about what you mean by reactive.

  • @shubhamswaraj1968
    @shubhamswaraj1968 3 года назад

    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?

    • @TechPrimers
      @TechPrimers  3 года назад

      It depends on the reviewer. Some ppl checkout the branch locally to see the changes however the diffs should help access the impact.

  • @vigneshr.3601
    @vigneshr.3601 3 года назад +1

    Even though I don't like Java. Your explanation on spring boot made it easier to understand.

  • @prashantgodhwani6304
    @prashantgodhwani6304 3 года назад

    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

  • @sachinmisal4829
    @sachinmisal4829 3 года назад +1

    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.

    • @TechPrimers
      @TechPrimers  3 года назад

      Those videos are already there. I will try to link them in description

    • @TechPrimers
      @TechPrimers  3 года назад +1

      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

    • @sachinmisal4829
      @sachinmisal4829 3 года назад

      @@TechPrimers thank you very much, sir

    • @itshgirish
      @itshgirish 2 года назад

      @@TechPrimers Thanks Much! ... this is what i was looking for

  • @azharmobeen
    @azharmobeen 3 года назад +1

    If we have Entities then why we need DTOs ? Until unless we needed for specific purpose we shouldn't go for DTA right?

    • @TechPrimers
      @TechPrimers  3 года назад +1

      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

  • @InterviewDOT
    @InterviewDOT 3 года назад +1

    Wow excellent presentation thanks for sharing 👌🙏

  • @shubhamswaraj1968
    @shubhamswaraj1968 3 года назад

    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

    • @TechPrimers
      @TechPrimers  3 года назад

      This question should be addressed to your team mates Shubham. It depends on what systems you are connecting to.

  • @salasoft2104
    @salasoft2104 3 года назад +1

    awesome and very interesting continue

  • @mikalshrestha2055
    @mikalshrestha2055 3 года назад

    please make videos on clean architecture for springboot microservices api. most of the production grade application are built using clean architecture

  • @DJSS855
    @DJSS855 3 года назад +1

    Nice Explanation

  • @sureshsadanala4639
    @sureshsadanala4639 3 года назад +1

    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 :)

    • @TechPrimers
      @TechPrimers  3 года назад

      Sure. Some of them are already there suresh. You can check them in the channel

    • @sureshsadanala4639
      @sureshsadanala4639 3 года назад

      @@TechPrimers okay Ajay. thanks again :)

  • @sreedarshshaji5951
    @sreedarshshaji5951 3 года назад +2

    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?

    • @TechPrimers
      @TechPrimers  3 года назад +1

      Thank you. Glad it's helpful sreedarsha.
      I'm from Chennai

  • @beinspired9063
    @beinspired9063 3 года назад +1

    Precise and nice.

  • @impractical_shivani5831
    @impractical_shivani5831 3 года назад +1

    Aah, the ACG tee-shirt! 🙌

  • @sandeepkumarrayala6738
    @sandeepkumarrayala6738 3 года назад

    Can you say is lambok is really useful .. Is it is plugin or dependency .. I have always issue with lambok project..

    • @TechPrimers
      @TechPrimers  3 года назад

      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

  • @TheEntium
    @TheEntium 3 года назад +2

    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
      @TechPrimers  3 года назад +1

      It's already there in the channel. Check it here ruclips.net/video/jA1wHbAK_T0/видео.html

    • @TheEntium
      @TheEntium 3 года назад +1

      @@TechPrimers Thanks man you are amazing!

    • @TechPrimers
      @TechPrimers  3 года назад

      Cheers bud

  • @codegeek8256
    @codegeek8256 3 года назад

    Can you please do your setup tour video, showing your setup.

    • @codegeek8256
      @codegeek8256 3 года назад

      Your workstation

    • @TechPrimers
      @TechPrimers  3 года назад +1

      I have that in my Instagram page. Take a look there

    • @codegeek8256
      @codegeek8256 3 года назад

      @@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.

  • @vikrambhaik5010
    @vikrambhaik5010 3 года назад +1

    Plz make video on knative with spring Boot

  • @flipper71100
    @flipper71100 3 года назад

    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.

    • @flipper71100
      @flipper71100 3 года назад

      for scalability we have HorizontalPodAutoscaler object

    • @TechPrimers
      @TechPrimers  3 года назад +1

      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

  • @karthickselvam3938
    @karthickselvam3938 3 года назад +1

    Hi,
    Please make video on performance issue on springboot and how to resolve,it will be useful to us.

    • @TechPrimers
      @TechPrimers  3 года назад +1

      Sure Karthick. Any specific performance aspect are you looking at?

    • @karthickselvam3938
      @karthickselvam3938 3 года назад +1

      @@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...

    • @karthickselvam3938
      @karthickselvam3938 3 года назад +1

      @@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...

    • @TechPrimers
      @TechPrimers  3 года назад +1

      sure Karthik. Good topic. Will do that soon.

    • @karthickselvam3938
      @karthickselvam3938 3 года назад

      @@TechPrimers Thank you very much... you are great ...😊

  • @dvskr1
    @dvskr1 3 года назад +1

    Authentication and authorisation... monitoring and centralized logging

    • @TechPrimers
      @TechPrimers  3 года назад +1

      Dont they default to having them these days. 😀
      Thanks for adding them D.

  • @inzi27
    @inzi27 3 года назад +1

    good one👍🏼

  • @JaNaMSoNi
    @JaNaMSoNi 3 года назад +1

    Thank you so much ❤️

  • @shingiraibondai747
    @shingiraibondai747 3 года назад

    An example of a piece of code would've been nice ☺

  • @aronblanche
    @aronblanche 3 года назад +1

    Thank you

  • @vishalbihani4710
    @vishalbihani4710 3 года назад +2

    Awesome !

  • @asashish905
    @asashish905 3 года назад

    Loved it, but you could have added some examples.

    • @TechPrimers
      @TechPrimers  3 года назад

      Its in the description Ashish

  • @antonmosenbacher9045
    @antonmosenbacher9045 3 года назад

    Well, @Autowired is not even recommended by Spring itself.
    If you are using lombok, then use @RequiredArgsConstructor and make the field private final

  • @filosofisto
    @filosofisto 3 года назад +1

    Good, but should have code examples, maybe broke it in a series of videos

    • @TechPrimers
      @TechPrimers  3 года назад

      I have those videos linked in the description Eduardo. Take a look at them.

    • @filosofisto
      @filosofisto 3 года назад +1

      @@TechPrimers Great, I will take a look, thank you

  • @venkatakallagunta8278
    @venkatakallagunta8278 3 года назад

    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.

  • @ozzydemir2325
    @ozzydemir2325 3 года назад

    you could have showed some code

    • @TechPrimers
      @TechPrimers  3 года назад +1

      Apologies ozzy, missed it. However i have example references in the description

  • @SwikarP
    @SwikarP 3 года назад

    👍

  • @lokeshnerella8710
    @lokeshnerella8710 2 года назад

    showing more examples would have been better rather than news reading

    • @TechPrimers
      @TechPrimers  2 года назад

      Check description for those videos

  • @maheshtambe9535
    @maheshtambe9535 3 года назад

    Nothing new

    • @TechPrimers
      @TechPrimers  3 года назад +3

      Which denotes you are already following best practices Mahesh 🙂

    • @maheshtambe9535
      @maheshtambe9535 3 года назад

      @@TechPrimers Sorry, I am big fan of your content following you for long time.