HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🚀
Random Bit Flip
/
🚀
[2기 - 우기] 5주차 RBF
/
WebApplicationContext, REST

WebApplicationContext, REST

WebApplicationContext

  • ApplicationContext를 확장한 인터페이스
  • WebApplication에 필요한 기능들을 추가
  • 구현체로는 AnnotationConfigWebApplicationContext, XmlWebApplicationContext
 
notion image

Root ApplicationContext 등록 - ContextLoaderListener

  1. xml로 등록하는 방법
notion image
  1. 자바로 등록하는 방법
    1. notion image

DispatcherServlet

  • dispathcerServlet을 생성할 때 WebApplicationContext를 사용한다
    • notion image
 
 
참고
www.baeldung.com
https://www.baeldung.com/spring-web-contexts
ContextLoaderListener vs DispatcherServlet - HowToDoInJava
In XML based Spring MVC configuration, you must have seen two declarations in web.xml file i.e. ContextLoaderListener and DispatcherServlet. Let's try to understand their purpose in framework and their differences. Root and child contexts Before reading further, please understand that - Spring can have multiple contexts at a time.
ContextLoaderListener vs DispatcherServlet - HowToDoInJava
https://howtodoinjava.com/spring-mvc/contextloaderlistener-vs-dispatcherservlet/
ContextLoaderListener vs DispatcherServlet - HowToDoInJava
 
 
 

REST - Representational State Transfer

notion image
  • 자원의 표현에 의한 상태를 전달하는 소프트웨어 아키텍처
  • 구성
    • 자원 (Resource)
    • 행위 (Verb)
    • 표현 (Representational)

특징

  • 클라이언트 - 서버
  • Stateless
  • Cacheable
  • Uniform Interface - URI로 지정한 리소스에 대한 조작을 통일되고 한정적인 인터페이스로 수행하는 아키텍쳐 스타일

REST API = REST 아키텍처 스타일을 따르는 API

한계

  • 표준이 없다
  • 사용할 수 있는 method가 한정 GET/PUT/POST/DELETE

Spring에서 애노테이션 제공

  • @RequestBody
  • @ResponseBody
  • @RestController = @Controller + @ResponseBody