IntelliJ Java IDE
The moose likes Spring and the fly likes Is this an example of Dependency Injection? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "Is this an example of Dependency Injection?" Watch "Is this an example of Dependency Injection?" New topic
Author

Is this an example of Dependency Injection?

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 147
Hi,

Is the following code in my Struts action where I am retrieving a Spring bean an example of Dependency Injection?



If so then which of the 3 categories does it fall into? Interface, constructor, or setter injection?

Thanks for any help,
Jehan
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12612
I'm not sure *why* you'd do it this way, but this particular code snippet isn't really dependency injection, since you're retrieving the bean manually.

Now, the "beanName" property might fall into one of those categories (well, at least constructor (unlikely) or setter (most likely)) but we can't tell.
 
 
subject: Is this an example of Dependency Injection?
 
Threads others viewed
Inversion of control
What is dependency injection?
passing beans..
SCEA assignment query
Pluggable Components
developer file tools