김영한 스프링 입문/섹션2.스프링 웹 개발 기초
정적 컨텐츠
스프링 부트 정적 컨텐츠 기능
Spring Boot Features
Graceful shutdown is supported with all four embedded web servers (Jetty, Reactor Netty, Tomcat, and Undertow) and with both reactive and Servlet-based web applications. It occurs as part of closing the application context and is performed in the earliest
docs.spring.io
resources/static/hello-static.html
MVC와 템플릿 엔진
MVC : Model, View, Controller
* Ctrl+P : 파라미터 정보 (컨트롤러에서 @RequestParam 등의 코드 위치에서 확인 가능)
http://localhost:8080/hello-mvc 접근시 에러 > 컨트롤러에 정의한 name 파라미터가 필요하기 때문
http://localhost:8080/hello-mvc?name=test
API
http://localhost:8080/hello-string?name=test
http://localhost:8080/hello-api?name=test
Json으로 응답받음
*getter/setter 단축키 사용
(java bean injection, 프로퍼티 접근 방식)
@ResponseBody 사용 원리
따라서
정적 컨텐츠 : 그냥 파일을 그대로 내려준다
템플릿 엔진 : 모델, 뷰, 컨트롤러 방식으로 쪼개어 뷰를 템플릿 엔진으로 html을 프로그램 렌더링 된 html 을 클라이언트에게 전달해준다.
API : 객체를 반환.HttpMessageConverter 등을 통해서 ..