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

  Рет қаралды 38,928

Dan Vega

Dan Vega

Жыл бұрын

Join me as we dive deep into the world of Spring Beans and explore the key differences between @Component and @Bean annotations. In this comprehensive guide, we'll break down their unique features, use cases, and best practices, empowering you to make informed decisions when developing your next Spring application. Don't miss this opportunity to enhance your Spring Framework expertise and take your skills to the next level!
🔗Resources & Links mentioned in this video:
Blog Post: www.danvega.dev/blog/2017/05/...
Spring Boot Crash Course: • Spring Boot Tutorial f...
Dependency Injection in Spring: • Dependency Injection S...
Constructor Injection: • Spring Constructor Inj...
👋🏻Connect with me:
Website: www.danvega.dev
Twitter: / therealdanvega
Github: github.com/danvega
LinkedIn: / danvega
Newsletter: www.danvega.dev/newsletter
SUBSCRIBE TO MY CHANNEL: bit.ly/2re4GH0 ❤️

Пікірлер: 74
@satyarajawasthismart
@satyarajawasthismart Жыл бұрын
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.
@TheSeTrous
@TheSeTrous 6 ай бұрын
This is an ABSOLUTE banger Finally i have no misunderstandings on beans, components and even spring container
@connor8875
@connor8875 2 ай бұрын
Finally! Finally a video that explains this without ramming meaningless jargon down my ears 😁 You've got yourself a new subscriber!
@donglaizhang7895
@donglaizhang7895 2 ай бұрын
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 2 ай бұрын
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.
@shreypatel9379
@shreypatel9379 5 ай бұрын
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 Жыл бұрын
I absolutely love your videos, please don’t stop making!
@moonly3781
@moonly3781 Жыл бұрын
Finally!!! Thank you, Dan. You're the best✌
@samarthurs8000
@samarthurs8000 Жыл бұрын
As always, very valuable content for free. Much Appreciated!
@codingwithraphael
@codingwithraphael 7 ай бұрын
You are a true hero Dan!! You’ve just breakdown it so understandable that I’m very impressive.. thank you thank you
@itsjaylogan
@itsjaylogan 11 ай бұрын
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 🎉
@flow_987
@flow_987 8 ай бұрын
Incredibly illuminating. Thank you!
@meilyn22
@meilyn22 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!
@nikhilxxsharma
@nikhilxxsharma 6 ай бұрын
This is gold, brilliant Dan, you are amazing.
@ddarkodev2923
@ddarkodev2923 Жыл бұрын
Thank you, Dan!! So helpful 💪
@petersteel7735
@petersteel7735 Жыл бұрын
Thank you Dan! Quality content!!!
@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!
@crillin570
@crillin570 Жыл бұрын
Thanks Dan, these are very helpful.👍
@israelduarte1326
@israelduarte1326 Жыл бұрын
Thank you for the video!
@libraniel
@libraniel 11 ай бұрын
You're great Dan, thank you and happy coding! 😃
@yasminaitmaksene5230
@yasminaitmaksene5230 7 ай бұрын
Thank's a lot ! Your explanations really helped me to understand how Spring Beans work :D
@xyvadimxy
@xyvadimxy Жыл бұрын
It's really helpful explanation. Thanks Dan!
@munnieswaroop
@munnieswaroop Ай бұрын
Excellent explanation, got some things cleared
@rajkumarvb5197
@rajkumarvb5197 5 ай бұрын
Thanks Dan, it was helpful!
@myst.youtube
@myst.youtube 4 ай бұрын
no joke this tutorial of bean and component 100% clear than water.
@random-characters4162
@random-characters4162 Жыл бұрын
Very good and dense content! Thx
@meysam.85
@meysam.85 Жыл бұрын
Thanks @dan, i find it useful. Thanks
@peachezprogramming
@peachezprogramming 3 ай бұрын
Great video. Thanks for making!
@DanVega
@DanVega 2 ай бұрын
Thanks for watching
@ornelfranck
@ornelfranck 11 ай бұрын
Nicely done!
@ravipandey29
@ravipandey29 3 ай бұрын
Thanks , it is really helpful.
@zakariyaechmaili5647
@zakariyaechmaili5647 Жыл бұрын
Thanks ❤️
@codex8797
@codex8797 5 ай бұрын
Thank you, really helped
@KennethKousen
@KennethKousen Жыл бұрын
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. :)
@DineshkumarPuli
@DineshkumarPuli Жыл бұрын
Wow! It is Ken! 😮
@KennethKousen
@KennethKousen Жыл бұрын
@@DineshkumarPuli Snicker. No, it's Dan :⁠-⁠)
@kay2care
@kay2care Жыл бұрын
Nice job!
@mehnaazmohiuddin
@mehnaazmohiuddin 7 ай бұрын
Very Cool video @Dan ! For anyone who can't see spring plugin, Spring plugin is available in Ultimate Edition , not the free one.
@gauthamfz19
@gauthamfz19 9 ай бұрын
Awesome explanation!
@DanVega
@DanVega 9 ай бұрын
Thank you!
@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.
@brayanmnz
@brayanmnz Жыл бұрын
Nice shirt, I got mine from Devnexus!
@MrRexxarHell
@MrRexxarHell 10 ай бұрын
Dude, you explain it so well, that when I have questions about Spring, I go to your channel. Thanks for your work!
@francogiulianopertile279
@francogiulianopertile279 Жыл бұрын
Good Tutorial
@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.
@FranklyTerrible
@FranklyTerrible 5 ай бұрын
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...
@user-zw3kc8qd1z
@user-zw3kc8qd1z 4 ай бұрын
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.
@GoodBoy-lr7up
@GoodBoy-lr7up 9 күн бұрын
Really clear!3ku
@shashanksurekhapapde6143
@shashanksurekhapapde6143 Жыл бұрын
Nice video ! how do i get spring in tool window . Is it only on ultimate edition ?
@mlensment
@mlensment Жыл бұрын
Can you cover spring beans and concurrency?
@ningw5169
@ningw5169 11 ай бұрын
Hey Dan what's the theme you are using?
@enesb4797
@enesb4797 4 ай бұрын
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)
@adityavardhanagarwal495
@adityavardhanagarwal495 Жыл бұрын
Can you create a spring security crash course as well please ?
@christopherreif3624
@christopherreif3624 Жыл бұрын
My goodness yes! This would be so helpful.
@ypathan420
@ypathan420 Жыл бұрын
He has a playlist on spring security
@santiagomorales9129
@santiagomorales9129 Жыл бұрын
also he recommended Laur Spilca on that particular topic
@Curiosidades-ki2oi
@Curiosidades-ki2oi 9 ай бұрын
Which theme are you using in your IntelliJ?
@FredrikRambris
@FredrikRambris Жыл бұрын
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?
@crlychar
@crlychar 6 ай бұрын
Thak you for the tutorial. I have a question. How can i get the same UI of the Intellij IDEA like yours?
@iterator
@iterator 11 ай бұрын
Thanks for the great content! Could you share the font you're using?
@fatihkobacik
@fatihkobacik 8 ай бұрын
i think it's cascadia-code font of microsoft
@kyleryxn
@kyleryxn 3 ай бұрын
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 2 ай бұрын
He literally explained it in this video. It's not rocket science.
@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
@mzlobecki
@mzlobecki Жыл бұрын
what is the shortcut for emoji please? 😄
@keithlockey7129
@keithlockey7129 10 ай бұрын
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.
@anon3746
@anon3746 4 ай бұрын
Wait why don't we just make all the methods in Controler and Service static and then we don't need beans for them? I mean why even initialize a Controller class?
@USONOFAV
@USONOFAV 11 ай бұрын
Why does @Bean doesn't work if you are returning a Collection type and you have to use @Resource?
@Keteku.
@Keteku. Жыл бұрын
Why do you use a CommandLineRunner instead of just running System.out.println()
@annyeong987
@annyeong987 5 ай бұрын
You didn't show how to get that spring view tool
@qzf4928
@qzf4928 Жыл бұрын
我不会英语,但是通过字幕我学习的很慢但是我会坚持的
@hypekg5719
@hypekg5719 11 ай бұрын
What's wrong with your camera? Adjust the focus before recording a video
@otaxhu8021
@otaxhu8021 9 ай бұрын
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 28 күн бұрын
/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/
МАМА И STANDOFF 2 😳 !FAKE GUN! #shorts
00:34
INNA SERG
Рет қаралды 3,4 МЛН
Универ. 10 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:04:59
Комедии 2023
Рет қаралды 2,7 МЛН
Alat Seru Penolong untuk Mimpi Indah Bayi!
00:31
Let's GLOW! Indonesian
Рет қаралды 7 МЛН
What is a POJO in Java? Almost EVERYONE Gets This Wrong
5:05
Coding with John
Рет қаралды 119 М.
4 Spring Boot Mistakes to AVOID in 2024
15:18
Java Brains
Рет қаралды 53 М.
Spring Annotations for Experienced Developers #springboot #java
10:51
Spring ultimate basics: What are Spring Beans and what is the Spring Container?
16:30
Java is slow and verbose (or so they say)
20:39
Dan Vega
Рет қаралды 9 М.
Life cycle of spring beans with bean creation process in detail.
28:09
Dive Into Development
Рет қаралды 8 М.
Java Bean vs POJO vs Spring Bean | Are you confused too ?
6:29
in28minutes - Get Cloud Certified
Рет қаралды 63 М.
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 2 МЛН
Какой ПК нужен для Escape From Tarkov?
0:48
CompShop Shorts
Рет қаралды 272 М.