티스토리 뷰
[Spring] root-context.xml와 servlet-context.xml
Mysql 연동 전에 먼저 알아야할 것이 root-context.xml 입니다.
context 관련 xml은 root-context와 servlet-context가 있습니다.
root-context.xml 이란?
JSP와 관련없는 객체(bean)을 설정합니다.(service, repository) |
비지니스 로직을 위한 설정을 합니다. |
외부 jar 파일등으로 사용하는 클래스는 <bean>태그를 이용하여 작성합니다. |
공통 빈을 설정합니다. |
저는 view와 밀접하지 않은 정보를 기술하는 xml이라고 이해하고 있습니다.
그렇다면 Mysql관련 설정은 view(jsp)와 관련이 있을까요?
이 말을 바꿔보면 Mysql에 jsp가 직접적으로 접근을 할까요?
정답은 No
그렇기 때문에 Mysql에 접속하기위한 user와 password 등 관련 설정은
root-context.xml에 기술합니다.
이 외에도
@Service 어노테이션이 설정된 class 같은 경우(비지니스 로직)도 view(jsp)에서 직접 접근을 하지않습니다.
관련된 <context:component-scan class="----"/> 태그 같은 경우도
root-context.xml에 작성합니다.
servlet-context.xml 이란?
JSP와 관련있는 객체(bean) 설정 - controller, MultipartResolver, Interceptor(로그인 등) |
WEB Application 에서 client 요청을 받기 위한 설정 |
어노테이션 <annotation-driven/> |
URL 관련 설정 |
servlet-context.xml 같은 경우 jsp와 관련된 설정들을 합니다.
jsp에서 js, image, css와 같은 resource 찾기 위한 설정을 합니다.
로그인과 관련된 interceptor를 추가할수도있습니다.
(아직 한번밖에 안해봐서 잘 이해하지는 못하고있습니다 ㅠ)
추후에 공부해서 알게되는 것들 점차적으로 추가하겠습니다^.^
'Study > Spring' 카테고리의 다른 글
[Spring] Mybatis 연동 (1) (0) | 2018.12.24 |
---|---|
[Spring] Mysql과 JUnit (2) (0) | 2018.12.24 |
[Spring] Mysql과 JUnit (1) (0) | 2018.12.24 |
[Spring] pom.xml (0) | 2018.12.24 |
[Spring] 디렉터리 구조 (0) | 2018.12.24 |
- Total
- Today
- Yesterday
- Get
- clss
- install
- mysql
- vscode
- pom.xml
- import
- servlet-context.xml
- root-context.xml
- instant
- mybatis
- jUnit
- dataSource
- cordova
- mybatis-spring
- php
- spring
- web.xml이란?
- postman
- react
- 디스크 없음
- 설치
- sqldeveloper
- 디렉터리
- Window10
- Oracle
- Semantic
- Resources
- Connection-Pool
- create-react-app
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |