새소식

반응형
WEB/Thymeleaf

jar 파일 배포시 Thymeleaf 리소스 못찾는 문제 해결 방법

  • -
반응형

2024-02-21


사진: Unsplash 의 Claudio Schwarz


1. 방법

 

application.properties 에 설정해 둔 경로 확인

 

# Thymeleaf
spring.thymeleaf.enabled=true
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.encoding=UTF-8
#spring.thymeleaf.cache=false

 

return 경로가 "/home/home" 이런식으로 되어 있으면 경로 못 찾음 spring.thymeleaf.prefix=classpath:/templates/ 에서 이미 / 를 붙여 주었으니 아래와 같이 되어 있는지 확인

 

   @GetMapping("/home")
    public String getHomeView(Model model){
		. . .
        return "home/home";
    }

메인 이미지 출처 :사진: UnsplashClaudio Schwarz  

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.