Dependency Injection Spring: How to use Dependency Injection in Spring Boot

preview_player
Показать описание
In this tutorial, you will learn what Dependency Injection in Spring is by building a Spring Boot application. I love writing tests because they can expose some issues with how your application is constructed. Follow along as we write some Spring Boot tests that show the problems in our application and how Dependency Injection can solve them. By the end of this video, you will have a good idea of how to use Dependency Injection in your Spring applications.

🔗Resources & Links mentioned in this video:

👋🏻Connect with me:

Рекомендации по теме
Комментарии
Автор

As a SpringBoot beginner I found your explanation about DI extremely insightful. Kudos to you !

xbxnbkb
Автор

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.

samarthurs
Автор

thank you ! it is so awesome that we have created rest api in 8 mins. powerful spring !

OmerFarukAY-ijxg
Автор

thank you! waiting excitedly for the new spring project videos

OmerFarukAY-ijxg
Автор

I love how are you using unit tests to test stuff, very useful .

denischiosa
Автор

This is amazing! Really helped solidify Dependency Injection for me. Thanks Dan you are a Spring legend :)

jonnycoddington
Автор

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.

theladyjaiproject
Автор

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.

andrezanlorensi
Автор

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

aliksargsyan
Автор

Excellent work Dan!

Really easy to follow your explanations and benefits of Dependency Injection :)

Arsy
Автор

Thanks Dan Vega.. love it, we do need more videos on Testing...

benjamine.ndugga
Автор

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.

marouaniAymen
Автор

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

facu
Автор

hey do you mind slowing down a bit and take more time explaining the litte things >:D

sugoi
Автор

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?

alapatisrikanth