Top "Dependency-injection" questions

A design pattern to reduce coupling between components, by dynamically injecting into a software component dependencies that it needs to function.

What is dependency injection?

There have been several questions already posted with specific questions about dependency injection, such as when to use it and …

design-patterns language-agnostic dependency-injection terminology
How can I inject a property value into a Spring Bean which was configured using annotations?

I have a bunch of Spring beans which are picked up from the classpath via annotations, e.g. @Repository("personDao") …

java spring dependency-injection
ASP.NET Core Dependency Injection error: Unable to resolve service for type while attempting to activate

I created an .NET Core MVC application and use Dependency Injection and Repository Pattern to inject a repository to my …

c# dependency-injection asp.net-core asp.net-core-mvc
Inversion of Control vs Dependency Injection

According to the paper written by Martin Fowler, inversion of control is the principle where the control flow of a …

dependency-injection inversion-of-control
Resolving instances with ASP.NET Core DI from within ConfigureServices

How do I manually resolve a type using the ASP.NET Core MVC built-in dependency injection framework? Setting up the …

c# dependency-injection asp.net-core asp.net-core-mvc
Why do I need an IoC container as opposed to straightforward DI code?

I've been using Dependency Injection (DI) for a while, injecting either in a constructor, property, or method. I've never felt …

dependency-injection inversion-of-control ioc-container
Injecting Mockito mocks into a Spring bean

I would like to inject a Mockito mock object into a Spring (3+) bean for the purposes of unit testing with …

spring dependency-injection junit annotations mockito