I am a newbie in Spring and am trying to understand the below concept.
Assume that accountDAO is a dependency of AccountService.
accountDAO
AccountService
Scenar
Use @Component and @Autowire, it's the Spring 3.0 way
@Component public class AccountService { @Autowired private AccountDAO accountDAO; /* ... */ }
Put a component scan in your app context rather than declare the beans directly.