springframe中的petstore中的setServlet()什么时候调用

springframework 自带的例子jpetstore中的BaseAction类
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;
}

}

中的setServlet()方法什么时候调用的啊?为什么?

你可能感兴趣的:(spring,tomcat,log4j,servlet,struts)