BACKEND/JAVA & SPRING

[J2KB] 정적 컨텐츠

이-프 2023. 2. 10. 19:06

** 인프런 [스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술] 강의를 기반으로 작성합니다. 

 

정적 컨텐츠 

서버에서 뭐 하는  것 없이 파일을 그대로 웹브라우저로 내려주는 것

 

 

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

 

<!DOCTYPE HTML>
<html>
<head>
  <title>static content</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
정적 컨텐츠 입니다.
</body>
</html>

 

> 결과 페이지

 

> 정적 컨텐츠 구조화

 

 

Spring은 항상 controller가 우선 순위를 갖는다.

  1. controller에 hello-static관련 controller가 있는지 확인
  2.  그렇다면, hello-static이란 html 자체를 찾게됨
  3. 그 html 자체를 브라우저에 출력해줌

 

 

 

 

'BACKEND > JAVA & SPRING' 카테고리의 다른 글

[J2KB] API  (0) 2023.02.10
[J2KB] MVC와 템플릿 엔진  (1) 2023.02.10
[J2KB] Spring View 환경설정  (2) 2023.02.03
[J2KB] SPRING 라이브러리  (0) 2023.02.03
[J2KB] 프로젝트 환경설정  (1) 2023.02.03