1. 개요
단순히 Restful API만 리턴하려고 했는데, View 처리도 필요할것 같다. (그냥 공부할겸)
resources/templates
로의 경로 설정을 해주어야하는데 예전에 짤막하게 Thymeleaf 라이브러리를 쓰면 알아서 경로설정을 해주는것으로 알고 있었다.
그래서 Thymeleaf Dependency 추가하고 하던대로 했는데, 계속 Error Page가 나왔다.
알고보니 application.properties
에 설정값을 작성해야 하더라.
다시 잊을까봐 기록한다.
2. 안되던 것
resources/static
에 있는 index.html
은 localhost:8080/index.html
로 잘만 접속되는데
resources/templates
에 있는 home.html
은 localhost:8080/home
으로 접속 시도해도 계속 에러 페이지가 나옴
3. 해결
알고 보니 resoureces/application.properties
에 다음과 같은 설정값을 작성해야 함.
prefix와 suffix만 추가해도 된다.
밑의 cache는 개발할때 수정 내역이 바로 반영되도록 하여 변경하기 편하도록 설정한것이고
check-template-location은 디렉토리에 파일이 있는지 확인하고 없으면 에러 발생시키도록 하는것이다.
끝!
'Java > Spring' 카테고리의 다른 글
[Spring] Security 사용기(3) LoginController → Security Filter (0) | 2024.07.09 |
---|---|
[Spring] Security 사용기(2) Security 라이브러리 추가 (0) | 2024.07.05 |
[Spring] Security 사용기(1) Login API(Controller) (0) | 2024.07.02 |
[Spring] Security 사용기(0) 개요 + User 도메인 생성 + 회원가입 API (0) | 2024.06.03 |