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.

Dagger 2 - what is the purpose of a @Singleton annotation class

From the dagger 2 Documentation I noticed that you can have a @Singleton annotated class. What is the purpose of marking …

dependency-injection dagger dagger-2
Unit testing code with a file system dependency

I am writing a component that, given a ZIP file, needs to: Unzip the file. Find a specific dll among …

unit-testing dependency-injection dependencies
What is Ninject and when do you use it?

I have been helping a few friends on a project and there is a class that uses Ninject. I am …

c# dependency-injection ninject
Unit Testing File I/O

Reading through the existing unit testing related threads here on Stack Overflow, I couldn't find one with a clear answer …

c# unit-testing file-io dependency-injection nunit
Accessing ASP.NET Core DI Container From Static Factory Class

I've created an ASP.NET Core MVC/WebApi site that has a RabbitMQ subscriber based off James Still's blog article …

c# asp.net-core dependency-injection rabbitmq service-locator
Ninject WithConstructorArgument : No matching bindings are available, and the type is not self-bindable

My understanding of WithConstructorArgument is probably erroneous, because the following is not working: I have a service, lets call it …

c# exception-handling dependency-injection ninject ninject-2
Symfony2: Inject current user in Service

I am trying to inject the currently logged in user into a service. My goal is to extend some twig …

php dependency-injection symfony fosuserbundle
Is dependency injection useful in C++

C# uses Dependency Injection (DI) a lot to have a lossless and testable platform. For this, I need an interface …

c# c++ dependency-injection inversion-of-control loose-coupling
Spring Property Injection in a final attribute @Value - Java

A simple question on Spring injection from a properties file for a final attribute. I have a properties file which …

java spring dependency-injection properties properties-file