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.

InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Http.IHttpContextAccessor'

I started to convert my asp.net core RC1 project to RC2 and faced with problem that now IHttpContextAccessordoes not …

.net dependency-injection asp.net-core
Is there a pattern for initializing objects created via a DI container

I am trying to get Unity to manage the creation of my objects and I want to have some initialization …

dependency-injection inversion-of-control unity-container ioc-container interface-design
How to avoid Dependency Injection constructor madness?

I find that my constructors are starting to look like this: public MyClass(Container con, SomeClass1 obj1, SomeClass2, obj2.... ) with …

c# java dependency-injection inversion-of-control ioc-container
Loading spring application context files that are inside a jar in classpath

I am trying to use ClassPathXmlApplicationContext in my java standalone code to load applicationContext.xml that is inside a jar …

spring dependency-injection classpath
How to instantiate spring managed beans at runtime?

I stuck with a simple refactoring from plain java to spring. Application has a "Container" object which instantiates its parts …

java spring dependency-injection refactoring guice
What is Castle Windsor, and why should I care?

I'm a long-time Windows developer, having cut my teeth on win32 and early COM. I've been working with .NET since 2001, …

c# dependency-injection inversion-of-control castle-windsor
.NET Core DI, ways of passing parameters to constructor

Having the following service constructor public class Service : IService { public Service(IOtherService service1, IAnotherOne service2, string arg) { } } What are the …

c# asp.net-core dependency-injection .net-core ioc-container
Android MVVM Design Pattern Examples

I currently do a lot of WPF development and have started creating some basic Android apps. When creating WPF apps …

java android design-patterns mvvm dependency-injection
Difference between @Bean and @Autowired

Why can't I use @Autowired in this case? @SpringBootApplication public class Application { @Autowired BookingService bookingService; public static void main(String[] …

java spring dependency-injection
Dependency injection, inject with parameters

I'm using vNext implementation of DI. How to pass parameters to constructor? For example, i have class: public class RedisCacheProvider : …

c# asp.net-core dependency-injection asp.net-core-mvc