Absolutely wonderful demo and explanation for DI using SpringBoot. Inversion of Control --> Inverting the Control, i.e., Swapping the Responsibility of Creating/Managing the Object's(Preferably, Usually, a Singleton) lifecycle... Initially, this was done by the Developer (with new() keyword which is ugly and bad practice) but now letting the Spring Container do it for us. Before the DI & IoC, we had to do the hard work. But now the framework does all the hard work. The control is inverted :-D Spring framework scans for the annotations like @Component, @Service, @Repository, @RestController, and so on. Bonus: This video also shows how to use Mockito to write lightweight Unit Tests instead of heavyweight & time-consuming integration tests.
I'm a beginning Java programmer, thrown into the deep end of the pool. I had to learn Java, Junit, Mockito, SpringFramework, Maven and a huge application in roughly 2 months. This video was a huge help... Thank you for taking the time to put this together. It will be a constant reference for me.
Thank you for your time making the video about dependency injection that has been immensely helpful to me. Their clear and concise explanation of this complex topic has enabled me to better understand and implement this important software design pattern. Thank you so much for taking the time to share your knowledge and expertise with others.
I actually came into this video to see what is the best practice of DI in Spring, but I learned more than I expected :) Is it safely to say "Constructor Injection is the best practice" Dan?
Thanks for the video. I'm using Spring Boot at work, but for controller tests I prefer applying a MockMvc object and mock service dependency in order to test for various controller HTTP code HttpHTTP EntityResponse codes like 200-400. In my personal point of view, this test approach more accurate and correct that instantiating and invoking the controller's method, because the controller is supposed to return entities "wrapped" in HTTP response codes and we can test the JSON output in case of REST APIs.
Hey Dan, thanks a lot for this type of content! It's really enjoyable. Are you planning to make a video about custom error handling in Spring? I'm a begginer in the Spring world and would like to learn about how to manage properly the error responses for a REST api
At 21:00 why are u not calling the slugify method as like this this.service.slugify Instead u calling without "this." Prefix ? Why this works this way?
I really didn't need to use this on line 17. this refers to the current object and it's useful when you are trying to be specific when you have arguments of the same name being passed to the constructor. If you omit this Java just expects you mean the current object.
Absolutely wonderful demo and explanation for DI using SpringBoot.
Inversion of Control --> Inverting the Control, i.e., Swapping the Responsibility of Creating/Managing the Object's(Preferably, Usually, a Singleton) lifecycle...
Initially, this was done by the Developer (with new() keyword which is ugly and bad practice) but now letting the Spring Container do it for us. Before the DI & IoC, we had to do the hard work. But now the framework does all the hard work. The control is inverted :-D
Spring framework scans for the annotations like @Component, @Service, @Repository, @RestController, and so on.
Bonus: This video also shows how to use Mockito to write lightweight Unit Tests instead of heavyweight & time-consuming integration tests.
As a SpringBoot beginner I found your explanation about DI extremely insightful. Kudos to you !
I'm a beginning Java programmer, thrown into the deep end of the pool. I had to learn Java, Junit, Mockito, SpringFramework, Maven and a huge application in roughly 2 months. This video was a huge help... Thank you for taking the time to put this together. It will be a constant reference for me.
how are you doing so far?
thank you ! it is so awesome that we have created rest api in 8 mins. powerful spring !
Thank you for your time making the video about dependency injection that has been immensely helpful to me. Their clear and concise explanation of this complex topic has enabled me to better understand and implement this important software design pattern. Thank you so much for taking the time to share your knowledge and expertise with others.
thank you! waiting excitedly for the new spring project videos
I love how are you using unit tests to test stuff, very useful .
Hey Dan, thank you for all of your effort. I stuggle many time to understand the concept of dependency injection, but I learnt a lot by your channel
I'm so glad I could be of help Alik.
This is amazing! Really helped solidify Dependency Injection for me. Thanks Dan you are a Spring legend :)
Absolutely wonderful
Thanks Dan Vega.. love it , we do need more videos on Testing...
I completely agree. I believe I saw you in Spring Office Hours yesterday, hope that discussion helped.
Thanks Dan Vega for great session
You're welcome, Shiva.
I actually came into this video to see what is the best practice of DI in Spring, but I learned more than I expected :) Is it safely to say "Constructor Injection is the best practice" Dan?
Thanks for the video. I'm using Spring Boot at work, but for controller tests I prefer applying a MockMvc object and mock service dependency in order to test for various controller HTTP code HttpHTTP EntityResponse codes like 200-400. In my personal point of view, this test approach more accurate and correct that instantiating and invoking the controller's method, because the controller is supposed to return entities "wrapped" in HTTP response codes and we can test the JSON output in case of REST APIs.
Thanks for sharing!
Excellent work Dan!
Really easy to follow your explanations and benefits of Dependency Injection :)
Glad you think so! Appreciate the kind words.
Thank you Dan very nice explanation
Amazing basics covered
Hey Dan, thanks a lot for this type of content! It's really enjoyable. Are you planning to make a video about custom error handling in Spring? I'm a begginer in the Spring world and would like to learn about how to manage properly the error responses for a REST api
I am now, thanks for the suggestion github.com/danvega/office-hours/discussions/31
Thank you
hey do you mind slowing down a bit and take more time explaining the litte things >:D
At 21:00 why are u not calling the slugify method as like this this.service.slugify
Instead u calling without "this." Prefix ?
Why this works this way?
I really didn't need to use this on line 17. this refers to the current object and it's useful when you are trying to be specific when you have arguments of the same name being passed to the constructor. If you omit this Java just expects you mean the current object.