sap服务器应用webservice加载spring的机制问题

import org.springframework.web.context.WebApplicationContext;

public class ServicesSingleton {
    private WebApplicationContext servletContext;
    private static ServicesSingleton instance = null;
    protected ServicesSingleton() {
    }
    public static ServicesSingleton getInstance() {
        if (instance == null)
            instance = new ServicesSingleton();
        return instance;
    }
    public WebApplicationContext getServletContext() {
        return servletContext;
    }
    public void setServletContext(WebApplicationContext servletContext) {
        this.servletContext = servletContext;
    }
}
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.context.WebApplicationContext;

public class InitServlet extends HttpServlet {
    @SuppressWarnings("resource")
    @Override
    public void init() throws ServletException {
        /*WebApplicationContext ctx = WebApplicationContextUtils
                .getRequiredWebApplicationContext(getServletContext());
        ServicesSingleton.getInstance().setServletContext(ctx);*/
        ApplicationContext context =new ClassPathXmlApplicationContext("classpath:META-INF/spring/*-context.xml");
    }
}


<servlet>
      <servlet-name>initServlet</servlet-name>
      <servlet-class>**.**.InitServlet</servlet-class>
      <load-on-startup>0</load-on-startup>
    </servlet>


你可能感兴趣的:(sap服务器应用webservice加载spring的机制问题)