- Arawn's Dev Blog
- Outsider's Dev Story
- Toby's Epril
- Benelog
- NHN 개발자 블로그
- SK 플래닛 기술 블로그
- OLC CENTER
- 소프트웨어 경영/공학 블로그
- 모바일 컨버전스
- KOSR - Korea Operating System …
- 넥스트리 블로그
- 리버스코어 ReverseCore
- SLiPP
- 개발자를 위하여... (Nextree 임병인 수석)
- "트위터 부트스트랩: 디자이너도 놀라워할 매끈하고 직관…
- Learning English - The English…
- real-english.com
- 'DataScience/Deep Learning' 카테…
- Deep Learning Summer School, M…
- Deep Learning Courses
민서네집
WebApplication 에서 Spring Bean 가져오기 본문
기존 웹어플리케이션에서 Spring MVC를 추가하려고 한다.
이전 코드는 그대로 놔두고, mgmt 라는 폴더를 하나 만들어서 그 폴더 아래만 Annotation 을 Scan 하도록 설정했다.
applicationContext.xml 파일
<context:component-scan base-package="com.sample.mgmt">
<context:exclude-filter expression="org.springframework.stereotype.Controller"
type="annotation" />
</context:component-scan>
기존 패키지에서 Spring Bean 을 가져와서 사용하고 싶을 때는 어떻게 해야할까?
web.xml 에서
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>com.sample.config.AppServletContextListener</listener-class>
</listener>
'Spring' 카테고리의 다른 글
[spring] 어느 곳에서나 request 를 얻기. (0) | 2013.07.09 |
---|---|
Transaction 설정 파일 (0) | 2013.07.05 |
MyBatis 사용시 주의점 (0) | 2013.04.24 |
Java Custom Annotation Example (0) | 2013.04.23 |
Spring MVC From Handling Annotation Example (0) | 2013.04.23 |