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.

Dependency Injection vs Service Location

I am currently weighing up the advantages and disadvantages between DI and SL. However, I have found myself in the …

c# dependency-injection singleton dependency-management service-locator
Inject bean into enum

I have the DataPrepareService that prepare data for reports and I have an Enum with report types, and I need …

java spring dependency-injection autowired
Injecting dependencies into ASP.NET MVC 3 action filters. What's wrong with this approach?

Here's the setup. Say I have some action filter that needs an instance of a service: public interface IMyService { void …

c# asp.net-mvc asp.net-mvc-3 dependency-injection actionfilterattribute
Unable to resolve ILogger from Microsoft.Extensions.Logging

I've configured my console application's Main like so var services = new ServiceCollection() .AddLogging(logging => logging.AddConsole()) .BuildServiceProvider(); And then …

c# .net dependency-injection .net-core ilogger
Entity Framework : Change connection string at runtime

Assuming there is an ASP.NET MVC application that uses Entity Framework 6 with code-first approach and StructureMap as IoC. Also …

c# asp.net-mvc entity-framework dependency-injection structuremap
Dagger: IllegalArgumentException: No injector factory bound for Class

I am new to Dagger 2. I have 2 Activities, I want to use injected ViewModel for both. Here is my ViewModuleFactory : @…

android dependency-injection dagger-2 dagger
MEF Constructor Injection

I'm trying to figure out MEF's Constructor Injection attribute. I have no idea how I tell it to load the …

c# dependency-injection mef constructor-injection
Spring Autowiring class vs. interface?

I have this Spring config: <bean id="boo" class="com.x.TheClass"/> The class TheClass implements TheInterface. Then …

java spring dependency-injection autowired
Inject and Resource and Autowired annotations

What's the difference between @Inject and @Resource and @Autowired annotations? When should we use each of them?

spring dependency-injection annotations cdi autowired
Autofac None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'

None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'LMS.Services.Security.EncryptionService' can be invoked …

c# dependency-injection inversion-of-control autofac ioc-container