怎样让spring重新初始化所有的bean

package x.x;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import org.springframework.context.support.AbstractRefreshableApplicationContext;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class ReloadAction extends BaseAction
{
    public ActionForward execute(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
        AbstractRefreshableApplicationContext context = (AbstractRefreshableApplicationContext) this.getWebApplicationContext();
        context.refresh();
       
        return mapping.findForward("success");
    }
}

你可能感兴趣的:(Spring,J2EE)