2023-08-22T09:43:42.587+09:00 ERROR 36788 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].
[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path []
threw exception [Request processing failed:
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [URL],
template might not exist or might not be accessible by any of the configured Template Resolvers]
with root cause org.thymeleaf.exceptions.TemplateInputException:
Error resolving template [URL],
template might not exist or might not be accessible by any of the configured Template Resolvers
at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869)
~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607)
~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1103)
~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1077)
~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at ...
참 이상한 일이다 ..
프론트에서 서버로 데이터를 요청했고, 심지어 요청 내용이 서버로 잘 넘어갔다.
원하는 데이터를 잘 담아오는 것을 log와 debugging으로 확인했고,
그걸 프론트에서 받아주기만 하면 되는데 그게 안되고 오류가 발생했다.
컴파일 오류가 없었고, 문제가 없다고 생각했는데 왜 안되지 ..?
혹시나 싶어 원래 반환 값을 List<반환 형태>
로 줬던 것을
ResponseEntity<List<반환 형태>>
로 변경해서 return 해주어 보았다.
반환 형태를 ResponseEntity로 감싸주지 않으면 오류가 나는건가 ..?
그리고 해당 메소드에 @ResponseBody도 붙여주어야 한다!
프론트 쪽에서 json 형태로 값을 받아줄 것이기 때문이다.
(현재 해당 클래스가 @Controller 라면)