messages.properties 파일을 만든 다음에 thymeleaf를 사용하여 속성 값을 출력할 수 있다.
예시
▼ 파일명: messages.properties
common.homeWelcome=환영합니다.
▼ 파일명: index.html
<p th:text="#{common.homeWelcome}"></p>
포인트
Thymeleaf 구문을 사용해야하기 때문에 th:text를 사용하고 #(샵)하고 { }(중괄호) 안에 속성 이름을 작성해준다.
'자료 보관함 > Java | SpringBoot' 카테고리의 다른 글
[SpringBoot] Enum (0) | 2024.11.07 |
---|---|
[SpringBoot] @JsonFormat (0) | 2024.11.07 |
[SpringBoot] .of() 메서드 (0) | 2024.11.06 |
[SpringBoot] @RestController, @RequestMapping, ResponseEntity, @RequestBody, ResponseEntity.ok() (0) | 2024.11.05 |
[Java] Collection, Collections의 차이 (0) | 2024.10.29 |