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.

Autofac with multiple implementations of the same interface

I'm using Autofac and would like to have multiple implementations of an interface. How can I configure Autofac so to …

c# dependency-injection inversion-of-control autofac
Autowiring in servlet

i want to use spring autowiring in servlet so here's my code: @Configurable public class ImageServlet extends HttpServlet { @Autowired private …

spring jakarta-ee servlets dependency-injection autowired
How to registerType with a PARAMETER constructor?

How do I registertype with the container where the type doesn't have NO PARAMETER constructor. In fact my constructor accepts …

dependency-injection unity-container ioc-container
Spring JSF integration: how to inject a Spring component/service in JSF managed bean?

I understand that a managed bean works like a controller, because your only task is "link" the View Layer with …

spring jsf dependency-injection integration managed-bean
An error occurred when trying to create a controller of type 'TypeNewsController'

I have searched long and hard but found nothing that helped yet. Where am I going wrong? I really do …

asp.net-mvc dependency-injection autofac asp.net-apicontroller
How to set up dependency injection using Dagger for things other than Activities and Fragments?

I started setting up dependency injection using Dagger as follows. Please feel encouraged to correct my implementation since I might …

android dependency-injection android-asynctask android-contentprovider dagger
Proper way to register HostedService in ASP.NET Core. AddHostedService vs AddSingleton

What is the proper way to register a custom hosted service in ASP.NET Core 2.1? For example, I have a …

c# asp.net-core .net-core dependency-injection asp.net-core-hosted-services
Generic repository in ASP.NET Core without having a separate AddScoped line per table in Startup.cs?

I have a generic repository in my project. Consider the following controller snippet public class Lookup1Controller : Controller { readonly MyDbContext _…

generics dependency-injection asp.net-core asp.net-core-mvc
Constructor Injection in C#/Unity?

I'm using C# with Microsoft's Unity framework. I'm not quite sure how to solve this problem. It probably has something …

c# dependency-injection unity-container constructor-injection
Base controller constructor injection in ASP.NET MVC with Unity

I have a base controller in my MVC 5 project which implements some shared functionality. This functionality requires some dependencies. I …

c# asp.net-mvc dependency-injection inversion-of-control unity-container