April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Example-2b
nExample with DI
npublic class WeatherServiceImpl implements WeatherService {
n  private WeatherDao weatherDao;
n  public void setWeatherDao (WeatherDao weatherDao) {
n    this.weatherDao = weatherDao;
n  }
n}
nXML descriptor file
n<bean id="weatherService" class="swe645.ioc.WeatherServiceImpl">
n  <property name="weatherDao">
n    <ref local="weatherDao"/>
n  </property>
n</bean>
n<bean id="weatherDao"
n  class="swe645.ioc.StaticDataWeatherDaoImpl">
n</bean>
n