本文共 958 字,大约阅读时间需要 3 分钟。
org.springframework.web.context.ContextLoaderListener
contextConfigLocation classpath:applicationContext.xml
//1. 获取servletContext对象ServletContext sc=ServletActionContext.getServletContext();//2. 从sc中获取ac容器WebApplicationContext ac=WebApplicationContextUtils.getWebApplicationContext(sc);//3. 从容器中获取CustomerServiceCustomerService service=(CustomerService)ac.getBean("customerService");
转载地址:http://nduyk.baihongyu.com/