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.

How to programmatically resolve property placeholder in Spring

I currently work on a web application based on Spring 3.1.0.M1, annotations based, and I have a problem with resolving …

spring jsp dependency-injection jsp-tags custom-tag
Simple Injector unable to inject dependencies in Web API controllers

I am attempting to do some basic constructor DI with Simple Injector, and it seems that it is unable to …

c# asp.net-web-api dependency-injection simple-injector
Spring circular reference example

I have a circular reference in one of my projects at work using spring, which I am unable to fix, …

java spring dependency-injection autowired circular-reference
Why am I getting PHP Fatal error: Uncaught Error: Class 'MyClass' not found?

This works: class MyClass { public $prop = 'hi'; } class Container { static protected $registry = []; public static function get($key){ if(!array_key_…

php oop dependency-injection namespaces autoloader
How does Mockito @InjectMocks work?

Here's my question: I have several web services classes to test that all inherit their methods from a generic service. …

spring dependency-injection mockito autowired
How to retrieve annotated instance from Guice's injector?

Let's say I have a module: Module extends AbstractModule { @Override protected void configure() { bind(String.class). annotatedWith(Names.named("annotation")). …

java dependency-injection configuration annotations guice
Pass parameter to constructor with Guice

I have a factory as below, public final class Application { private static IFoo foo; public static IFoo getFoo(String bar) { // …

java dependency-injection guice
How to create dependency injection for ASP.NET MVC 5?

Creating Dependency Injection with ASP.NET Core is fairly easy. The documentation explains it very well here and this guy …

c# asp.net asp.net-mvc dependency-injection asp.net-mvc-5
Spring Expression Language (SpEL) with @Value: dollar vs. hash ($ vs. #)

I'm a little confused concerning when to use ${...} compared to #{...}. Spring's documentation only uses #{...}, but there are plenty of examples …

spring dependency-injection spring-el
Dependency Injection & Singleton Design pattern

How do we identify when to use dependency injection or singleton pattern. I have read in lot of websites where …

design-patterns oop dependency-injection