일반적으로 스프링에서 서비스를 등록해놓으면 스프링 내에서 사용을 하는데
이번에 구축된지 오래된 소스를 신규 스프링 소스와 프로젝트를 합치는 과정에서 특이한 케이스로 스프링에서 등록해놓은 서비스를
jsp 내에서 가져와서 사용해야하는 경우가 생겨서 아래 방법으로 사용하였습니다.
ServletContext servletContext = getServletContext();
WebApplicationContext waContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
ExamService examService = (ExamService) waContext.getBean("ExamService");
WebApplicationContext.getBean에 서비스 이름을 넣어서 서비스를 가져와 사용하는 방법 입니다.
[egov] 전자정부프레임워크로 인한 package javax.servlet.jsp.tagext does not exist 오류 (0) | 2015.08.05 |
---|---|
[Spring] form에서 날짜 값을 받을때 typeMisMatch 오류 해결방법 (0) | 2015.07.17 |
[tomcat] 톰캣 버전확인 (0) | 2014.09.11 |
[jsp] MultipartFile로 받은 이미지의 바이너리 추출 (0) | 2014.08.12 |
[egovFrame] 컨트롤러에서 Map 형식 파라미터 받기 (0) | 2014.07.01 |
댓글 영역