How to use a Provider with Google Guice (Part 1)

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

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

  • @markbdsouza
    @markbdsouza Год назад

    I have to say, this tutorial is BRILLIANT ! Ive come from a spring boot/ spring background and was looking to understand the code base for a new project that uses guice, and your tutorials really help me at work. Thank you !

  • @ryanmosser4157
    @ryanmosser4157 2 года назад +5

    So wild this is still helpful today even after 6 years. There's literally no videos out there on Guice to this day. Good job, would be cool to get updated version on this stuff too.
    I'm sure there are other people like me who are I'm less likely to click on videos if they're old because of how fast things change in software development, there's always the thought in the back of my head, does this still apply today?

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

    The best explanation about DI on YT, period.

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

      Thanks John, I'm blushing! ;)

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

      @@MVPJava The explanation is very well structured and DI nowadays is totally important to understand for a developer. The pain with other tutorials/vids is e.g. spring boot tuts that it is assumed that you use it but without a deeper understanding you will not get how things work. It‘s like using spring boot without knowing beans or spring core, something like that. Don‘t think you‘re pro without knowing the things behind :-) Thats my ambition. For a beginner guice is a very good example to get into DI.

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

      @@returncode0000 totally agree. Too easy to get sucked in and lost in the upper layers these days. Thanks for your feedback John, much appreciated!

  • @manuagrawal7468
    @manuagrawal7468 5 лет назад +7

    What a great series!! Coming from a spring background, this is exactly what I needed. You deserve many more subscribers than you have!!

    • @MVPJava
      @MVPJava  5 лет назад +1

      Thanks Manu, I appreciate the comment! Please share and spread the word then ;)

    • @manuagrawal7468
      @manuagrawal7468 5 лет назад +1

      @@MVPJava Sure!! It'll be great if you could organize such topics into playlists. They become really easy to share with others and store.

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

    Succinct and highly informative. Most of the content available on internet covers basic only. Thanks for covering actual concept required in industry . Great WORK !! Keep making content like this.

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

      Thanks Paras, highly appreciated!

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

    Thank you so much for making this series.

  • @swethachowdary9218
    @swethachowdary9218 7 лет назад +2

    WOW!!! That was great explanation. Thanks a lot:) . I am using Google Guice at work and cant really ask colleagues all the doubts.
    You really made my day. This was awesome tutorial.

  • @JayantKatia
    @JayantKatia 2 года назад +1

    Superb!

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

    Amazing tutorials!! Much thanks for creating and sharing them.

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

      I'm glad they helped. Thanks for letting me know.

  • @ameyapatil1139
    @ameyapatil1139 8 лет назад +3

    Wonderful video ! Please keep up good work, very clear explanation and very simple and to the point examples

  • @manojrao9867
    @manojrao9867 2 месяца назад

    Excellent.

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

    Excellent series @MVP Java!. Just curious if you could reorder the videos by keeping the "Injecting single interface..." at the beginning.. Thanks a lot!

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

      Thanks Sushmita! Yes, great suggestion. I must of missed that. I just changed it. Thank-you!

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

      @@MVPJava Always Welcome :). You deserve kudos.

  • @judgelaloicmoi
    @judgelaloicmoi 4 года назад

    clear, excellent tutorials ! thank you and continue the good work !

    • @MVPJava
      @MVPJava  4 года назад

      Thanks Vincent, glad it helped you out!

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

    Very useful video. Thanks for helping. :)

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

      Your welcome!

  • @Merc70
    @Merc70 8 лет назад +2

    In your implicitProvider example, you say you don't have Module, but in the Main code you do actually use a DiscountGuiceModule. See 4:30. You can see in the imports it comes from the explicitProvider package. I assumed you meant all these packages to be isolated examples, but they got mixed up.

    • @MVPJava
      @MVPJava  8 лет назад +1

      +Rob Reece Thanks for catching the copy-paste error .. my biggest temptation/weakness by far! In fact, looking back I should of maybe broke it up into separate projects but that's what you get with growing pains I guess.
      I ran the example with the import and removed the Module reference; hence leaving
      "Injector guice = Guice.createInjector();"
      It works as expected and verbally communicated. So in resume, a copy/paste error when porting the Main.java from one package to another for a different example.
      I will update the code online and also add an annotation to reflect the typo on the video at 4:30,
      Again, thank-you very much for bringing it to my attention.
      Cheers.

    • @MVPJava
      @MVPJava  8 лет назад

      your welcome, I appreciate the feedback.

    • @kv9022
      @kv9022 7 лет назад

      Thanks for the great tutorial, and just for clarification - how it would look like without the guice module?

    • @MVPJava
      @MVPJava  7 лет назад +1

      Hi +konstantin momchev, If you did not have a guice module like the DiscountGuiceModule then I'm afraid you would have to code your own Factory Design pattern to supply the correct object and also instantiate the factory yourself, then have to maintain the factory code yourself as time went on. Many of us don't do this anymore since the rise of dependency injection frameworks like Guice, Spring etc ...
      Thanks for your question.
      Cheers.
      -Andy

  • @trikynguyen9757
    @trikynguyen9757 4 года назад

    I was crying since I am a beginner but have to work with this thing at the first day of my work and that happens for more than a year until I see these videos. Cannot say thanks enough. I know it quite greedy but can you make some videos about design patterns like abstract factory or observer. Thanks so much for your videos.

    • @MVPJava
      @MVPJava  4 года назад +1

      Glad to hear Tri Nguyen, thank-you for letting me know!. I usually only make videos that are either very different than what you will find on similar Java channels or if I believe I am one of the first to address the topic. The Design patterns you mention are very well documented and covered in so many blogs and videos that I would not be able to distinguish myself from the other channels. Hope you understand! Good luck. I hope you stopped crying ;)

    • @trikynguyen9757
      @trikynguyen9757 4 года назад

      MVP Java hi there,
      still crying but with less tears. Thanks for your reply.

  • @pingpancheng4573
    @pingpancheng4573 8 лет назад +3

    nice video

  • @nayan3558
    @nayan3558 6 лет назад

    Awesome video, keep up the good work.

  • @chitrameens7668
    @chitrameens7668 7 лет назад

    Very well done

  • @999mayank999
    @999mayank999 8 лет назад +1

    Nice work!

  • @brelei4321
    @brelei4321 5 лет назад +1

    nice vid

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

    👍👍👍

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

      Thank you and just for the record, that is my first triple thumbs up!

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

      @@MVPJava hello from Russia🇷🇺, I am going to learn google guice, very interesting technology for my

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

      Hello back from Portugal and happy learning! Enjoy the Google Guice playlist.

  • @hemrajbhattarai9684
    @hemrajbhattarai9684 7 лет назад +1

    Great :)

  • @miscellaneous9932
    @miscellaneous9932 7 лет назад

    Clap!

    • @MVPJava
      @MVPJava  7 лет назад

      Thanks ... never got a clap before!

  • @ameyapatil1139
    @ameyapatil1139 4 года назад +1

    swell !

  • @shadaman6424
    @shadaman6424 4 года назад

    where is the last video you are referencing to something that doesn't exist

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

      he meant this video - ruclips.net/video/wNclLOTxQjk/видео.html

  • @radsimu
    @radsimu 7 лет назад

    the emphasis placed on the ideea that the "free provider" that comes with guice is a manner of late instantiation, is really misleading I think. A provider is a factory... that's it. Yes, you can use it in many ways, including passing the factory to some function instead of an already fabricated object.

    • @MVPJava
      @MVPJava  7 лет назад

      Hi Radu Simionescu,
      I see things differently - there is no misleading going on here. I said that you can choose to use the Provider or not depending on your use case (late instantiation due to expensive object creation) and/or preference. I think i made it clear that a Provider is a Factory since its the premise of the tutorial. Yes, you may decide to pass the Provider to a function but I myself prefer not to that that (unless like I said I had a use case for it). I rather ask for the things I need directly instead of ask for a factory and then ask for what I want from that factory. I feel it goes against the Law of Demeter which makes my code less clear on its intent/direct collaborators and makes my testing a bit more involved.
      Thanks for commenting.
      Cheers.