본문 바로가기

Java/Spring

[Spring] 정적 컨텐츠

1. Spring 웹 개발 방식

 

① 정적 컨텐츠
  - 서버에서의 처리없이 파일을 그대로 웹 브라우저에 전달

 

② MVC와 템플릿 엔진

  - MVC : Model, View, Controller

  - 템플릿 엔진 : html을 서버에서의 처리를 통해 동적으로 바꿔서 전달 ex) jsp, php

 

③ API

  - JSON 데이터 포맷으로 클라이언트에 전달

  - 서버끼리 통신할 때도 사용

 

 

 

 

 

 

2. 정적 컨텐츠

  • Spring Boot는 기본적으로 정적 컨텐츠 기능을 제공
  • /static, /public, /resources, /META-INF/resources 에 위치한 파일을 찾아 웹 브라우저에 그대로 전달

 

 

① 웹 브라우저에서 localhost:8080/hello-static.html 요청

② 내장 톰캣 서버가 요청을 받아서 Spring에 넘김

③ Spring은 먼저 컨트롤러 쪽에서 hello-static이 있는지 찾음

④ 없으면 /static, /public, /resources, /META-INF/resources에 있는지 찾음

⑤ 있으면 hello-static.html 반환

 

https://docs.spring.io/spring-boot/docs/current/reference/html/web.html#web.servlet.spring-mvc.static-content

 

Web

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

 

 

 

 

 

 

 

 

 

 

 

 

 

참고 - 인프런 무료 강의 : 스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술 [김영한님]
https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81-%EC%9E%85%EB%AC%B8-%EC%8A%A4%ED%94%84%EB%A7%81%EB%B6%80%ED%8A%B8/dashboard

 

[무료] 스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술 - 인프런 | 강의

스프링 입문자가 예제를 만들어가면서 스프링 웹 애플리케이션 개발 전반을 빠르게 학습할 수 있습니다., - 강의 소개 | 인프런...

www.inflearn.com

 

'Java > Spring' 카테고리의 다른 글

[Spring] API  (0) 2022.07.19
[Spring] MVC와 템플릿 엔진  (0) 2022.07.07
[Spring] 빌드하고 실행하기(Git Bash, CMD)  (0) 2021.10.20
[Spring] View 환경설정  (0) 2021.10.19
[Spring] Spring 라이브러리(dependencies)  (0) 2021.10.19