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.

@Resource vs @Autowired

Which annotation, @Resource (jsr250) or @Autowired (Spring-specific) should I use in DI? I have successfully used both in the past, @…

java spring dependency-injection annotations autowired
Why does one use dependency injection?

I'm trying to understand dependency injections (DI), and once again I failed. It just seems silly. My code is never …

dependency-injection
Why use @PostConstruct?

In a managed bean, @PostConstruct is called after the regular Java object constructor. Why would I use @PostConstruct to initialize …

java dependency-injection jakarta-ee cdi jsr299
Passing Parameters JavaFX FXML

How can I pass parameters to a secondary window in javafx? Is there a way to communicate with the corresponding …

javafx parameters dependency-injection parameter-passing fxml
Spring: Why do we autowire the interface and not the implemented class?

Example interface IA { public void someFunction(); } @Resource(name="b") class B implements IA { public void someFunction() { //busy code block } public …

java spring dependency-injection
Dependency Injection vs Factory Pattern

Most of the examples quoted for usage of Dependency Injection, we can solve using the factory pattern as well. Looks …

dependency-injection factory-pattern design-patterns
Requested bean is currently in creation: Is there an unresolvable circular reference?

i am using spring 3, and i have two beans of view scope: 1- Bean1: @Component("bean1") @Scope("view") public class …

spring dependency-injection autowired
Which .NET Dependency Injection frameworks are worth looking into?

Which C#/.NET Dependency Injection frameworks are worth looking into? And what can you say about their complexity and speed.

c# .net dependency-injection inversion-of-control
What is javax.inject.Named annotation supposed to be used for?

I am trying to understand the javax.inject package and I am not clear what the javax.inject.Named annotation …

java spring dependency-injection java-ee-6
exclude @Component from @ComponentScan

I have a component that I want to exclude from a @ComponentScan in a particular @Configuration: @Component("foo") class Foo { ... } …

java spring dependency-injection spring-boot spring-ioc