Spring Boot Thymeleaf Error) Error resolving template [~~~], template might not exist or might not be accessible by any of the configured Template Resolvers

반응형

 

Error

  • 특정 뷰를 설정하고 해당 페이지로 이동하려니 다음과 같은 에러가 출력

ERROR [nio-8081-exec-5] org.thymeleaf.TemplateEngine
[THYMELEAF][http-nio-8081-exec-5]
Exception processing template "~~~": Error resolving template [~~~],
template might not exist or might not be accessible by any of the configured Template Resolvers

org.thymeleaf.exceptions.TemplateInputException:
Error resolving template [~~~],
template might not exist or might not be accessible by any of the configured Template Resolvers

 


해결 방법

  • 뷰의 경로가 잘못되어 발생
  • 뷰의 경로 지정시 앞에 '/' 가 꼭 필요
// 기존 소스
registry.addViewController("/home/home").setViewName("home/home");

// 수정된 소스 : setViewName 앞에 '/' 추가
registry.addViewController("/home/home").setViewName("/home/home");

 

반응형