본문 바로가기

errorLog

template might not exist or might not be accessible by any of the configured Template Resolvers

 

template might not exist or might not be accessible by any of the configured Template Resolvers

 

템플릿 파일을 못찾거나 접근할 수 없을 때 발생하는 에러이다.

다른 controller에서는 잘 동작하는데 특정 controller에서 발생하길래 이유를 찾아보았다.

 

해결방법은 @Controller를 @RestController로 변경 혹은 메소드에 @ResponseBody 를 추가한다.

이유는 @Controller일 경우 return 값을 view에 매칭하려고 하기 때문이다.

@RestController는 HTTP ResponseBody 가 생성되는 방식과 유사하다.