본문 바로가기

강의 내용 정리/스프링 입문

정적 컨텐츠

https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/html/spring-boot-features.html#boot-features-spring-mvc-static-content

 

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

을 참고하면

 

By default, Spring Boot serves static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext. It uses the ResourceHttpRequestHandler from Spring MVC so that you can modify that behavior by adding your own WebMvcConfigurer and overriding the addResourceHandlers method.

 

 

정적 파일 ( static ) 은 /static에 넣는다. 

다음과 같은 구조시 localhost:8080/hello-static.html    로 이동하면

 

원하는 파일 넣으면 그 파일 그대로 반환



정적파일 ( 이미지, 동영상, html, js, css ) 이 바로 출력된다.

 

 

 

 

 

 

 

 

 

출처 : 인프런 김영한님의 강의를 수강 후 정리한 내용입니다.

 

 

 

 

꾸준히 다시보자.

 

1. 220712

2. 220731

 

 

 

 

Recent Posts
Popular Posts
Recent Comments