菜鸟碰到一个弄不明白的问题,好心人快来帮帮忙!

看代码
package dali.pigfriend.common.interfaces;
/**

  • 数据库信息管理业务接口。
  • 数据库信息管理逻辑
  • @author Administrator * / public interface DateManageService { /*
  • 初始化数据包类属性
  • @param datePack */ public void init(PageDatePack datePack);

/**

  • 查找数据
  • @param datePack 查询参数封装在该对象中 */ public void search(PageDatePack datePack);

/**

  • 保存数据修改
  • @param datePack */ public void save(PageDatePack datePack);

}

package dali.pigfriend.common.interfaces;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class BaseService implements DateManageService{

/**

  • dao类,与数据库交互的dao类 */ @Autowired @Qualifier("baseDao") private DateManageDao datManDao;

public DateManageDao getDatManDao() {
return datManDao;
}

public void setDatManDao(DateManageDao datManDao) {
this.datManDao = datManDao;
}

@Override
public void init(PageDatePack datePack) {
// TODO Auto-generated method stub
System.out.println("BaseService.init()");
}

@Override
public void search(PageDatePack datePack) {
// TODO Auto-generated method stub

}

@Override
public void save(PageDatePack datePack) {
// TODO Auto-generated method stub

}

}

package dali.pigfriend.backstage.base.action;
import org.springframework.beans.factory.annotation.Autowired;

import dali.pigfriend.backstage.base.service.MenuManageService;
import dali.pigfriend.backstage.base.service.TestService;
import dali.pigfriend.common.interfaces.*;

public class MenuManageAction extends BaseAction{
/**
*
*/
@Autowired
public MenuManageAction(MenuManageService menuManageService){
System.out.println("构造MenuManageAction类++++++++++");
this.setDatManSer(menuManageService);
}
private static final long serialVersionUID = 1L;

@Autowired
private TestService testService;

@Override
public String managePage() {
// TODO Auto-generated method stub
this.testService.init();
//搞不懂的是下面这行代码,就是它为嘛不调用DateManageService子类的init方法,而是调用父类BaseService的init方法
this.getDatManSer().init(super.getDatePack());
return RESULT_MANAGE_PAGE;
}

}

通过浏览器请求调用MenuManageAction动作类的managePage。

注意:DateManageService是一个接口定义,并非实现类或抽象类。