How do we implement di in spring framework?



How do we implement di in spring framework?..

Answer / Atif Masood

Dependency Injection (DI) can be implemented in Spring using the following techniques:
1. Constructor-based DI: Dependencies are injected through constructors.
2. Setter-based DI: Dependencies are injected through setters after object creation.
3. Field-based DI: Dependencies are directly injected into class fields.
4. Interface-based DI: A component is declared as an interface, and concrete implementations are provided for injection.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Spring Framework Interview Questions

Name some of the important spring modules?

1 Answers  


What is the better method of using jdbc in spring?

1 Answers  


What are bean wiring and @autowired annotation?

1 Answers  


What is a pointcut?

1 Answers  


What is the use of spring orm?

1 Answers  


What is webapplicationinitializer in spring?

1 Answers  


What is @pathparam?

1 Answers  


What is @required in spring?

1 Answers  


What is spring boot framework?

1 Answers  


Are spring beans thread safe?

1 Answers  


Are spring components singletons?

1 Answers  


What is spring boot jpa? : Spring Boot

1 Answers  


Categories