반응형

<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="org.springframework.web.support.WebApplicationContextUtils"%>
<%@page import="com.test.biz.service.TestService"%>

WebApplicationContextUtils.getWebApplicationContext(((HttpServletRequest) request).getSession().getServletContext());

//tomcat
//ServletContext servletContext = getServletContext();

//weblogic
ServletContext servletContext = pageContext.getServletContext();

WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

//서비스호출
TestService testService = (TestService)wac.getBean("testService");
//testService.testList();

반응형

+ Recent posts