

spring์์ Message๋ฅผ ๊ด๋ฆฌํ ์ ์๋ ์ค์ ํ์ผ์
๋๋ค.
messages.properties๋ code์ value๋ก ๊ตฌ์ฑ๋ฉ๋๋ค.
code=value ์ ๊ฐ์ ํํ๋ก ์์ฑํฉ๋๋ค.
resources ํด๋ ์๋ applicaton.properties์ ๊ฐ์ ๊ฒฝ๋ก์ messages.properties์ messages_en.properties ๋ฅผ ์์ฑํฉ๋๋ค.messages.properties๋ default ์ค์ ๊ฐ์ ์ ๊ณตํ ์ค์ ํ์ผ๋ก ํ๊ตญ์ด๋ฅผ ์ง์ํ๋๋ก ํ ๊ฒ์ด๊ณ , messages_en.properties๋ ์์ด๋ฅผ ์ง์ํ๋๋ก ์ค์ ํฉ๋๋ค.
messages.properties๋ถํฐ ์์ฑํฉ๋๋ค.

messages_en.properties ์ ์์ฑํฉ๋๋ค.

์ด์ ์ฐ๋ฆฌ๋ hello์ hello.name, title์ ์ฝ๋๋ก ํ๋ ์ธ ๋ฌธ์๋ฅผ ๊ตญ์ ํ ํ ์ ์๋ ์ค์ ์ ํด์ฃผ์์ต๋๋ค.
์๋์ ๊ฐ์ View๋ก ํ ์คํธ๋ฅผ ์งํํฉ๋๋ค.
thymeleaf์ #{ } ๋ฌธ๋ฒ์ message๋ฅผ ์ํจ ์
๋๋ค.<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 th:text="#{title}">์ ๋ชฉ</h1>
<p th:text="#{hello}"></p>
<p th:text="#{hello.name}"></p>
</body>
</html>
ํ
์คํธ ์ ์ ํ์ฌ ๋ธ๋ผ์ฐ์ ์ ์ธ์ด ์ค์ ์ ๋ณด๋ฅผ ํ์ธํฉ๋๋ค.
Chrome ํ๊ฒฝ์์ ์ธ์ด ์ค์ ์ ๋ณด๋ฅผ ํ์ธํ๋ ๋ฐฉ๋ฒ์
๋๋ค.

์ผ๋จ ํ๊ตญ์ด๋ฅผ ์ต์๋จ์ ๋๊ณ ์๋ฒ๋ฅผ ์คํํ์ฌ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํฉ๋๋ค.

๋ธ๋ผ์ฐ์ ์ ์ธ์ด ์ ๋ณด๋ฅผ ์์ด๋ก ๋ณ๊ฒฝํ๊ณ ๊ฒฐ๊ณผ๋ฅผ ๋ค์ ํ์ธํฉ๋๋ค.

์๋ฒ๋ฅผ ์ฌ์คํํ์ง ์๊ณ ์ธ์ด ์ค์ ์ ๋ณด๋ง ๋ณ๊ฒฝ ํ ์๋ก๊ณ ์นจ์ ์ํํ๋ฉด ์ธ์ด๊ฐ ๋ฐ๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.

์ธํ๋ฐ ๊น์ํ๋์ ์คํ๋ง MVC 2ํธ ์ ์๊ฐํ๊ณ ์ ๋ฆฌํ ๋ด์ฉ์ ๋๋ค.