자료 보관함/Java | SpringBoot
[SpringBoot] messages.properties
dev.jelee
2024. 11. 7. 18:51
messages.properties 파일을 만든 다음에 thymeleaf를 사용하여 속성 값을 출력할 수 있다.
예시
▼ 파일명: messages.properties
common.homeWelcome=환영합니다.
▼ 파일명: index.html
<p th:text="#{common.homeWelcome}"></p>
포인트
Thymeleaf 구문을 사용해야하기 때문에 th:text를 사용하고 #(샵)하고 { }(중괄호) 안에 속성 이름을 작성해준다.