Perhaps the following code will clarify. This code is based on the example already introduced in the Spring 2.5.6 documentation under 3.3.2.6.2. When XML file says:
Code:
p:spouse-ref="jane"
... it is trying to inject an instance of "com.example.Person" into the field named "jane" in your person. Your person object has a field like so:
Code:
public class Person {
private Person spouse;
// getters and setters.
}
Just because the text following the "p:" is "spouse-ref" doesn't mean there is a field called "spouse-ref" in the class. Since "-ref" is special, it sees that and looks for a field named just 'spouse' and not 'spouse-ref'.
Basically, if you use this, don't give your Java fields names ending in "Ref" such as:
Code:
public class Person {
private Person spouseRef;
// getters and setters.
}