2-Layerd 아키텍처 구조란?
- 스프링 기반에 자체 프레임워크 사용할때 구조를 이해하기 쉽게
new해주는 순서를 컨트롤 하기위해 고안된 아키텍처(구조)
구성 요소
클라이언트 Tier (Presentation Layer)
- 역할: 사용자 인터페이스 제공, 사용자 요청 처리
- 구성: 웹 애플리케이션, 데스크탑 애플리케이션 등 사용자가 직접 상호작용하는 부분
- 기능: 사용자 입력 수집하여 서버 전송
서버에서 받은 데이터 표시
서버 Tier (Data Layer)
- 역할: 비즈니스 로직, 데이터 처리
- 구성: 데이터베이스와 서버 애플리케이션으로 구성
- 기능: 클라이언트의 요청 수신 처리
데이터베이스와 상호작용하여 정보 저장, 검색
비즈니스 로직 수행 후 클라이언트에 반환
2-Layerd 아키텍처의 특징
- 간단한 구조: 구현이 간단하고, 소규모 애플리케이션이나 프로토타입에 적합
- 성능: 단순한 구조에서는 빠른 응답 속도를 제공
- 유지보수: 명확한 분리가 이루어져 있어, 독립적으로 업데이트하거나 유지보수 가능
루트 컨테이너
- web.xml : 서블릿 컨테이너(톰캣) 설정파일
- ds-servlet.xml : 스프링 컨테이너 설정파일
- applicationContext.xml : 스프링 컨테이너 (루트 컨테이너) 설정파일
1. web.xml에 바로 먼저 실행해주는 리스너 생성(not pojo)

2. BeanDefinitionStoreException 오류 발생 : xml파싱이 안되서 생기는 오류
- <context-param> 을 사용해서 xml 파싱 경로 설정
※ classpath : src/main/java를 뜻한다
<활용 코드 - web.xml>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://jakarta.ee/xml/ns/jakartaee" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" version="6.0">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>ds</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ds</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
<루트 컨테이너 - applicationContext.xml>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd">
<context:component-scan base-package="com.koreait.app.biz.common" />
<context:component-scan base-package="com.koreait.app.biz.board" />
<context:component-scan base-package="com.koreait.app.biz.member" />
</beans>
2024.10.15
'Spring' 카테고리의 다른 글
| [Spring] 10. AOP(관점 지향 프로그래밍) (0) | 2024.10.16 |
|---|---|
| [Spring] 09. Spring 비동기 처리 (0) | 2024.10.15 |
| [Spring] 07-5. 활용 코드 예시(Service) (0) | 2024.10.11 |
| [Spring] 07-4. 활용 코드 예시(DB) (0) | 2024.10.11 |
| [Spring] 07-3. 활용 코드 예시(Front, .xml 설정파일) (3) | 2024.10.11 |