springframework 自带的例子jpetstore中的BaseAction类
[code]public abstract class BaseAction extends Action {
private PetStoreFacade petStore;
public void setServlet(ActionServlet actionServlet) {
super.setServlet(actionServlet);
ServletContext servletContext = actionServlet.getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
this.petStore = (PetStoreFacade) wac.getBean("petStore");
}
protected PetStoreFacade getPetStore() {
return petStore;
}
}[/code]
中的setServlet()方法什么时候调用的啊?为什么?
[code]public abstract class BaseAction extends Action {
private PetStoreFacade petStore;
public void setServlet(ActionServlet actionServlet) {
super.setServlet(actionServlet);
ServletContext servletContext = actionServlet.getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
this.petStore = (PetStoreFacade) wac.getBean("petStore");
}
protected PetStoreFacade getPetStore() {
return petStore;
}
}[/code]
中的setServlet()方法什么时候调用的啊?为什么?