[Thymeleaf][Error] Template이 존재하지 않거나 Template Resolvers에 접근할 수 없음

희원·2022년 3월 30일
0

에러 메시지

Error resolving template “/fragments/header”, template might not exist or might not be accessible by any of the configured Template Resolvers

원인

기본 classpath가 templates/ 이기 때문에 path가 templates//fragments/header 가 되어 템플릿을 찾을 수 없었던 것

해결

1)
fragments/header로 수정

2)
path를 /fragments/header 그대로 두고, classpath를 변경하는 방법도 있다. application.properties 파일에 아래 코드 추가

spring.thymeleaf.prefix=classpath:/templates
profile
모든 시작은 사소함으로부터

0개의 댓글