Spring
jsp 에서 applicationcontext 얻어와서 getBean 사용하기.
티-스토리
2012. 11. 13. 11:33
Spring Context 관련 import
<%@ page import="
org.springframework.web.context.*,
org.springframework.web.context.support.*"%>
<%
ServletContext ctx = pageContext.getServletContext();
WebApplicationContext wac =
WebApplicationContextUtils.getRequiredWebApplicationContext(ctx);
%>
Spring Bean 호출하기
// getBean
XXX xxx = (XXX) wac.getBean("xxx");
xxx.doSomething();