April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Instantiate a UserDao Object in Application Code
nUserDao userDao;
n...
npublic void setUserDao( UserDao userDao) {
n  this.userDao = userDao;
n}
nNo more dependency on a specific implementation of the DAO. But who will call the setter?
n
nInversion of Control (IoC)
nThe application code is no longer responsible for instantiate an interface with a specific implementation, A.K.A. Dependency Injection
The DAO would be injected with a Session/Connection object