본문 바로가기
Spring Boot

Spring 정적 리소스 맵핑

by 상국이 2022. 2. 27.
728x90

- 기본 리소스 위치

  • classpath:/static
  • classpath:/public
  • classpath:/resources/
  • classpath:/META-INF/resource/

 > 위 경로에 요청에 해당하는 리소스가 있다면 자동으로 매핑하여 리턴

ex) https://localhost:8080/hello.html 이라는 요청시 /static/hello.html이 있는 경우 해당 리소스를 리턴

 

* 맵핑설정을 변경하고 싶은 경우

spring.mvc.static-path-pattern=/sangguk/**

이제는 https://localhost:8080/hello.html > https://localhost:8080/sangguk/hello.html 으로 요청해야함

728x90

'Spring Boot' 카테고리의 다른 글

HtmlUnit  (0) 2022.02.28
Thymeleaf  (0) 2022.02.28
ViewResolver  (0) 2022.02.27
HttpMessageConverters  (0) 2022.02.20
Spring boot 단위 테스트  (0) 2022.02.20

댓글