I am a newbie in Spring and am trying to understand the below concept.
Assume that accountDAO
is a dependency of AccountService
.
Scenar
and
public class AccountService {
AccountDAO accountDAO;
/* more stuff */
}
When spring finds the autowire property inside accServiceRef
bean, it will scan the instance variables inside the AccountService
class for a matching name. If any of the instance variable name matches the bean name in the xml file, that bean will be injected into the AccountService
class. In this case, a match is found for accountDAO
.
Hope it makes sense.