| Author |
Strange dependency injection goings on
|
james frain
Ranch Hand
Joined: Apr 06, 2011
Posts: 34
|
|
Looking at this example in more detail and trying tofigure out how this works.
see http://static.springsource.org/docs/Spring-MVC-step-by-step/part5.html
My question is ... in the class JdbcProductDaoTests, how is the method
actually called?
I can see in the test-context that the bean definition is declared as
However, here's the puzzler, if I rename the method to setProductDaoXXX it still works, but if I call it xxsetProductDao it can't resolve which method to call when building the context.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 23635
|
|
James,
By convention, setters begin with setXXX. When you renamed the method to xxsetProductDao(), it becomes just a random method and not a setter. This makes sense. Spring shouldn't have to look at every single method for dependency injection. Only the constructors and setters.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
|
 |
 |
|
|
subject: Strange dependency injection goings on
|
|
|