1

Is there any difference between Bean Injection and Dependency Injection in Spring, or are they the same?

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
Pawan Gaur
  • 11
  • 1
  • 3
  • I think you can refer below link [What is difference between resource injection and dependency injection (CDI) in Java](https://stackoverflow.com/questions/30060876/what-is-difference-between-resource-injection-and-dependency-injection-cdi-in) – Tejal Sep 20 '17 at 05:38

2 Answers2

0

Since the dependencies are beans in our context, yes we can say that they are the same.

okante
  • 97
  • 2
  • 11
0

Any dependency that is managed by Spring is called a Spring Bean. When you register a type in Spring, when it is used as a dependency in other objects, it is injected by Spring.

On the other hand, Dependency Injection doesn't need a container like Spring. When you have a method that takes arguments, that argument is a dependency, which is a form of dependency injection instead of hard code the value of the argument in your method.

Downhillski
  • 2,555
  • 2
  • 27
  • 39