IoC , Autowired & Dependency Injection Constructor vs Setter Injection | Java Spring Boot Framework

  Рет қаралды 23,607

Briano Codes

Briano Codes

Күн бұрын

Blog post i wrote about this : brianobruno.wordpress.com/202...
Hey guys! In this video i go over Spring Frameworks Inversion Of Control Capabilities and how to do Dependency Injection using Autowired and going over Constructor Injection VS Setter Injections and the benefits and negatives of each one.
If you have any questions go ahead and leave a comment and i'll get back to you!

Пікірлер: 30
@VALERIYA1PROCKO
@VALERIYA1PROCKO 3 жыл бұрын
I like that you actually explained how the code looks like without the dependency injection. Most videos on the subject do not show that.
@BrianoCodes
@BrianoCodes 3 жыл бұрын
I think it’s important to show what the technology solves / what is technically happening under the hood . We should challenge and ask why we’re doing something , this in turn helps us become better engineers ! I’m glad that you enjoyed the video!! Thank you for watching !
@samuel2318
@samuel2318 10 ай бұрын
Thanks for your clear explanation. It is much easier to understand constructor and setter injection.
@kevinnguyen8908
@kevinnguyen8908 3 жыл бұрын
Thanks for the tutorial! It made it clearer on why my Autowirings weren't working!
@prashantpharate
@prashantpharate 3 жыл бұрын
Liked your example which explained quite well how setter injection is optional
@manobalasubramaniam929
@manobalasubramaniam929 2 жыл бұрын
Seriously i was having a difficult time in understanding what's ioc and what's dependency injection. You've explained it so clearly
@tombrady7390
@tombrady7390 Жыл бұрын
great work man
@josheyanae7575
@josheyanae7575 6 ай бұрын
Really good explanation, thank you.
@BrianoCodes
@BrianoCodes 6 ай бұрын
Glad you enjoyed it!
@nodebynode4446
@nodebynode4446 2 жыл бұрын
Very well explained! Thank you!
@BrianoCodes
@BrianoCodes 2 жыл бұрын
Glad it was helpful!
@vivekvaradarajan8283
@vivekvaradarajan8283 3 жыл бұрын
I like this ! awesome !!!
@sanketatmaram
@sanketatmaram 4 жыл бұрын
sorted explanation loved it
@Daniel83021
@Daniel83021 Жыл бұрын
Your way to explain is awesome.. u are the best.. keep it simple 👍✌️👍
@BrianoCodes
@BrianoCodes Жыл бұрын
Thank you so much 😀
@deqnvelkovsky5619
@deqnvelkovsky5619 2 жыл бұрын
Extremely useful.
@BrianoCodes
@BrianoCodes 2 жыл бұрын
Glad to hear that!
@airah245
@airah245 3 жыл бұрын
I really like the explanation, you explain why we should follow a certain approach, it helps us understand better. Could you please elaborate what "Enhanced Testability" means? As you said, with DI, we can just mock other classes and inject those, what is done when DI is not used?
@ataiabdiev2355
@ataiabdiev2355 10 ай бұрын
keep going gj
@talltk
@talltk 3 жыл бұрын
Hi Briano, I have a POJO that is serializable to JSON that has a method called “execute”. Each of my POJOs carry out certain “Actions” that’s why they have an execute method on it. The execute method require the usage of an @Autowired component. How would I include this in? Setter injection?
@BrianoCodes
@BrianoCodes 3 жыл бұрын
Hey Zhenghao! Yes you can Have Setter/Constructor injection , however I would think about injecting the component into some service layer rather than on a POJO! and then you can pass it to execute , or decouple the execute from the object you're serializing in the first place
@god_bika
@god_bika Жыл бұрын
in other words spring app creates those 'component' objects under hood if you declared them via @Component annotation. In docs they explained that too hard using xml configuration one can barely understand. But you made me look on all this from height. ☝👍
@arindamdas11
@arindamdas11 2 жыл бұрын
Nice. a use case of each type would have added extra flavor.
@programming2347
@programming2347 10 ай бұрын
How did the howdy() method got executed if there is no place in code where you call a ClassA Instance. What exactly is calling the class instantiaton?
@BrianoCodes
@BrianoCodes 10 ай бұрын
Class A is a spring Bean , so the IOC Container controls instantiation of this object, as it is now marked as a component. Spring will manage this lifecycle and create an instance of class A. There are multiple different bean scopes that would control when / how spring creates it , but by default it a singleton scope , which means one will be created for the whole app at startup!
@rollinOnCode
@rollinOnCode 3 жыл бұрын
can you edit the video to make the code much more visible? it is really hard to see and quite small. would you be able to focus and zoom the video so we can follow along easier?
@ianbrown8408
@ianbrown8408 Жыл бұрын
FYI On a smartphone you the viewer can zoom in and see the code.
@andreferraz6287
@andreferraz6287 Жыл бұрын
Why is using reflection in field injection bad?
@BrianoCodes
@BrianoCodes Жыл бұрын
reflection has its place , but at the end of the day you're hacking what a developer intended to access things you shouldn't be, (not including performance implications) , since you're declaring your own beans you really shouldn't need to rely on a process that is specifically driven by reflection. you can simply use setter or constructor injection ... that's my elevator pitch version let me know if you that makes sense :D
@rohankavathekar
@rohankavathekar 2 жыл бұрын
9:12 I am confused.
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 12 МЛН
Spring ultimate basics: What are Spring Beans and what is the Spring Container?
16:30
Dependency Injection & Inversion of Control
11:00
Ryan Schachte
Рет қаралды 195 М.
Maven Vs Gradle - Which To Pick
5:54
Steve Codes
Рет қаралды 19 М.
10 Spring and Spring Boot Common Mistakes You Need To STOP
15:49
Amigoscode
Рет қаралды 145 М.
Spring Boot - @Autowired, @Qualifier, @Primary, @Required | Simple Programming
11:31
Learn Dependency Injection and Write Better Code
21:52
Amigoscode
Рет қаралды 170 М.
Spring | Autowire | Dependency Injection | Spring Boot
18:23
Telusko
Рет қаралды 581 М.
Ba Travel Smart Phone Charger
0:42
Tech Official
Рет қаралды 1,2 МЛН
low battery 🪫
0:10
dednahype
Рет қаралды 1,7 МЛН
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 6 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 494 М.
Как бесплатно замутить iphone 15 pro max
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 8 МЛН