Spring Beans Showdown: Unraveling the Mystery of @Component vs @Bean!

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

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

  • @satyarajawasthismart
    @satyarajawasthismart Год назад +33

    Can you make a crash course on Microservices too ?
    Really love to learn from your experience and way of explaining things. You really inspire me to teach others. Thank you for being there Mr. Vega.

  • @SeTrous
    @SeTrous 11 месяцев назад +5

    This is an ABSOLUTE banger
    Finally i have no misunderstandings on beans, components and even spring container

  • @meilyn22
    @meilyn22 7 месяцев назад +2

    Thank you. Best explanation. I've been hearing those terms and using them, but I never took the time to understand what they mean. Beans put methods in the application context, mostly used with the @Configuration annotation. @Component put classes into the application context. You are awesome!

  • @shreypatel9379
    @shreypatel9379 10 месяцев назад +1

    This is THE explanation. Like you explained everything in a much simpler way than all the other sources I have referred to. Thanks for such a wonderful tutorial!

  • @christopherreif3624
    @christopherreif3624 Год назад +9

    I absolutely love your videos, please don’t stop making!

  • @connor8875
    @connor8875 7 месяцев назад

    Finally! Finally a video that explains this without ramming meaningless jargon down my ears 😁 You've got yourself a new subscriber!

  • @peachezprogramming
    @peachezprogramming 8 месяцев назад +2

    Great video. Thanks for making!

    • @DanVega
      @DanVega  8 месяцев назад

      Thanks for watching

  • @donglaizhang7895
    @donglaizhang7895 7 месяцев назад +1

    Hi Dan, this is fantastic!! A lot of of these detailed information is hard to be found easily. With most of the tutorials and examples online, they only tell you what/how to do, but not why. Thank you!!

    • @DanVega
      @DanVega  7 месяцев назад

      I feel the same way and I am often trying to answer the questions that I have as well. Really glad you enjoyed it and thank you for the kind words.

  • @myst.youtube
    @myst.youtube 9 месяцев назад

    no joke this tutorial of bean and component 100% clear than water.

  • @angelmotta
    @angelmotta Месяц назад

    Thanks Dan! your example was clear and helped me to solidify my knowledge!

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

    You are a true hero Dan!! You’ve just breakdown it so understandable that I’m very impressive.. thank you thank you

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

    Finally!!! Thank you, Dan. You're the best✌

  • @Anonymous-zo9qr
    @Anonymous-zo9qr Месяц назад

    Understood clearly. Thanks!

  • @samarthurs8000
    @samarthurs8000 Год назад +1

    As always, very valuable content for free. Much Appreciated!

  • @libraniel
    @libraniel Год назад +1

    You're great Dan, thank you and happy coding! 😃

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

    Incredibly illuminating. Thank you!

  • @nikhilxxsharma
    @nikhilxxsharma 11 месяцев назад

    This is gold, brilliant Dan, you are amazing.

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

    Thank you so much. I’m just getting started with Spring and Spring Boot and this video helped me confirm some things I suspected! I will start your Spring training video 🎉

  • @KennethKousen
    @KennethKousen Год назад +7

    Nice job. A couple of quick comments:
    1. I had no idea that IntellIJ had a Spring view. Seems obvious in retrospect, but thanks for that.
    2. I'm surprised you didn't autowire the `RestTemplateBuilder` into the `@Bean` method rather than instantiate it yourself. The builder is available in the application context already, so make it an argument to your configuration method and it'll be autowired in automatically.
    3. Even though autowiring works as long as you have only a single constructor in a class, I usually add `@Autowired` anyway, partly as documentation, and partly as protection in case someone else adds a default constructor, at which point the automatic autowiring wouldn't work any more.
    Just a thought. :)

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

    Very Cool video @Dan ! For anyone who can't see spring plugin, Spring plugin is available in Ultimate Edition , not the free one.

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

    Thank's a lot ! Your explanations really helped me to understand how Spring Beans work :D

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

    Great content Dan! I was pretty familiar with all the concepts mentioned here, still the content was refreshing. Love the way you dive into things. Keep it up!

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

    Thank you, Dan!! So helpful 💪

  • @shahinrajaei1666
    @shahinrajaei1666 2 месяца назад +1

    youre tutorials are bot deep enough, i stii do nit know what beans

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

      read Spring Start Here chapters 1-4 and then come back, you'll understand it better. that book is worth reading and not too long.

  • @munnieswaroop
    @munnieswaroop 6 месяцев назад

    Excellent explanation, got some things cleared

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

    Thank you for the video!

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

    Thank you Dan! Quality content!!!

  • @FranklyTerrible
    @FranklyTerrible 10 месяцев назад +8

    Not going to lie, this example about beans only confused me more. How does Spring make that vague connection to the Resttemplate method? That seems like dark magic to me...

    • @ИвоСпасов-й5ш
      @ИвоСпасов-й5ш 9 месяцев назад +1

      I have been working on Spring projects and gathered some valuable knowledge! Spring basically has the so-called IoC container, which is associated with the dependency injection system it has been integrated with. In simple words, instead of trying to make new objects with the keyword "new" like "new User();", Spring will automatically inject this dependency for you. This can be done in 3 ways: through field, constructor or setter injection. That's it. Also, by default, the instances provided by spring are singleton, namely, only one instance is provided for the entire application context, which of course can be changed if you want.

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

      😂

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

    Thanks Dan, these are very helpful.👍

  • @rajkumarvb5197
    @rajkumarvb5197 10 месяцев назад

    Thanks Dan, it was helpful!

  • @meysam.85
    @meysam.85 Год назад

    Thanks @dan, i find it useful. Thanks

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

    Nicely done!

  • @random-characters4162
    @random-characters4162 Год назад

    Very good and dense content! Thx

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

    It's really helpful explanation. Thanks Dan!

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

    Awesome explanation!

  • @ravipandey29
    @ravipandey29 9 месяцев назад

    Thanks , it is really helpful.

  • @enesb4797
    @enesb4797 9 месяцев назад +1

    should we not use "new" keyword in classes even if they are just regular classes and not beans or components? let's say I have a helper class for math operations, shouldn't I use "new" keyword in its dependencies? (since you said you should stay away from using "new" keyword 6:54)

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

    Thanks ❤️

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

    Nice job!

  • @brayanmnz
    @brayanmnz Год назад +1

    Nice shirt, I got mine from Devnexus!

  • @codex8797
    @codex8797 10 месяцев назад

    Thank you, really helped

  • @adityavardhanagarwal495
    @adityavardhanagarwal495 Год назад +6

    Can you create a spring security crash course as well please ?

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

    Hi, I like your videos. I found a mistake on your Recent Articles page on your blog. You put "I like to write about anything thta I am currently working or something new that interests me." You misspelled the word "that". Thanks.

  • @KatarinaClaes-q1p
    @KatarinaClaes-q1p 2 месяца назад

    which vscode theme were you using here? I find yours way less cluttery looking than mine.

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

    Dan! Thank you for your content! It helps me to understand Springboot a lot better! Would you recommend goign through the documentation? I always seem to have trouble with creating queries to retrieve data from mysql.

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

    Dude, you explain it so well, that when I have questions about Spring, I go to your channel. Thanks for your work!

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

    Hello Dan,
    defining beans with @Bean annotation isn't truly an inversion of control, since we are returning a new bean explicitly with the "new" keyword like so:
    @Bean
    public SomeObject myBean(){
    return NEW SomeObject()
    }
    Please correct my understanding.
    Thanks

  • @Dina-Barbur
    @Dina-Barbur Год назад

    thank you, Dan! would you please tell about @component vs @repository. Both annotations are used in infrastructure layer of any REST app (storage or repository packages). I'm slightly confused by such diversity.

  • @FredrikRambris
    @FredrikRambris Год назад +1

    How about factories? Is there a way to register a factory that will return a bean when needed. Say a bean with generics. Is there such a way to easily register a bean factory?

  • @kyleryxn
    @kyleryxn 8 месяцев назад

    I like this video, but I think you cold update it with more clarification on best use cases for each. Like, when is it better to use @Component vs. @Bean?

    • @meilyn22
      @meilyn22 7 месяцев назад

      He literally explained it in this video. It's not rocket science.

  • @crlychar
    @crlychar 11 месяцев назад

    Thak you for the tutorial. I have a question. How can i get the same UI of the Intellij IDEA like yours?

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

    Hey Dan what's the theme you are using?

  • @Curiosidades-ki2oi
    @Curiosidades-ki2oi Год назад

    Which theme are you using in your IntelliJ?

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

    Thanks for the great content! Could you share the font you're using?

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

      i think it's cascadia-code font of microsoft

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

    Can you cover spring beans and concurrency?

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

    Nice video ! how do i get spring in tool window . Is it only on ultimate edition ?

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

    Good Tutorial

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

    Why does @Bean doesn't work if you are returning a Collection type and you have to use @Resource?

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

    what is the shortcut for emoji please? 😄

  • @Keteku.
    @Keteku. Год назад

    Why do you use a CommandLineRunner instead of just running System.out.println()

  • @annyeong987
    @annyeong987 10 месяцев назад

    You didn't show how to get that spring view tool

  • @qzf4928
    @qzf4928 Год назад +2

    我不会英语,但是通过字幕我学习的很慢但是我会坚持的

  • @GoodBoy-lr7up
    @GoodBoy-lr7up 5 месяцев назад

    Really clear!3ku

  • @kevinmaltby4202
    @kevinmaltby4202 27 дней назад

    2:00 I think here you first imply that simply creating an instance of a class means one gets a Spring bean. You then go on to correctly state that a Spring bean is an object that is _managed_ by the spring runtime. Call me a pedant but I think you need to be clear what is and what isn't a Spring bean afterall you are trying to explain what a Spring Bean is.

  • @mTsp4ce
    @mTsp4ce 4 месяца назад

    2:15 is a logical fallacy (affirming the consequent). A spring bean is an instance of a class, but not every instance of a class is a spring bean. Not off to a good start there, buddy...

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

    What's wrong with your camera? Adjust the focus before recording a video

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

    spring boot and all that thing of beans are bullshit dude it isn't declarative, I builded an application with jax-rs and it hasn't all this "magic things" of the spring runtime handling all the instances in the limbo, jax-rs (now called jakarta-rs) gives you more freedom.

  • @paulhetherington3854
    @paulhetherington3854 6 месяцев назад

    /krch dsk bean < R'(4''tvk''btx ruch)< ~tmp2''kf(2 inch 824x) @ rdsk~II tmp p''TdDxn gml rul txt tun//J namz krch 4''Rtvk abv + 2''UI' kol rul vd sim LN'' < rdacht~tmp p''2'(xvtn) rtun bean/
    /rbean dsk~tmp snd ruch vF8''btz dach txt tn R2''p~ K' rch + frch vktd rbean rul~tmp < txt tun ad cmd~gml + wn ml//+ hlf ruch < 28''frch contnt fiji kalchz rdsk - 4''tvk - fz 2''UI' id - txt tun - verifcate/