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 get an instance of IServiceProvider in .NET Core?

IServiceProvider is an interface with single method: object GetService(Type serviceType); It's used to create instances of types registered in .…

c# .net-core dependency-injection service-provider
Is spring default scope singleton or not?

Could you please explain why Spring is creating two objects for the configuration of beans shown below, since by default …

java spring dependency-injection singleton spring-ioc
What are the downsides to using Dependency Injection?

I'm trying to introduce DI as a pattern here at work and one of our lead developers would like to …

design-patterns dependency-injection
using Spring JdbcTemplate - injecting datasource vs jdbcTemplate

As per Spring documentation, the steps to use Spring JdbcTemplate is as follows: <?xml version="1.0" encoding="UTF-8"?> <…

java spring dependency-injection jdbctemplate
How to handle dependency injection in a WPF/MVVM application

I am starting a new desktop application and I want to build it using MVVM and WPF. I am also …

c# wpf mvvm dependency-injection dependencies
What exactly is Field Injection and how to avoid it?

I read in some posts about Spring MVC and Portlets that field injection is not recommended. As I understand it, …

java spring-mvc dependency-injection portlet autowired
Spring @Autowire on Properties vs Constructor

So since I've been using Spring, if I were to write a service that had dependencies I would do the …

spring dependency-injection constructor autowired
AngularJS seed: putting JavaScript into separate files (app.js, controllers.js, directives.js, filters.js, services.js)

I'm using the angular-seed template to structure my application. Initially I put all my JavaScript code into a single file, …

javascript angularjs dependency-injection
What's the difference between the Dependency Injection and Service Locator patterns?

Both patterns seem like an implementation of the principle of inversion of control. That is, that an object should not …

design-patterns dependency-injection service-locator
How to inject dependencies into a self-instantiated object in Spring?

Let's say we have a class: public class MyClass { @Autowired private AnotherBean anotherBean; } Then we created an object of this …

java spring dependency-injection