웹 브라우저에서 localhost:8080/hello-static.html을 치면 톰캣 서버에 요청이 들어와 스프링부트로 넘겨준다. 넘어오면 컨트롤러를 찾지만 없기 때문에 resource에서 static/hello-static.html을 찾아 그대로 넘긴다.
웹 브라우저에서 스프링부트로 넘어오면 관련 Controller를 먼저 찾음
=> Contoller가 우선순위를 가진다.
<p th:text="'hello '+${name}"> hello! empty</p>
#'hello '+${name} : 서버를 탈 때
# hello! empty : 서버 없을 때
웹 브라우저에서 localhost:8080/hello-mvc 를 치면 톰켓 서버에서 요청을 받아 스프링 부트로 넘기고 helloController를 찾는다. hello-template을 반환하고 viewResolver가 hello-templat과 같은 것을 찾아 templates/hello-template.html을 템플릿엔진에 넘긴다. 템플릿 엔진에서는 랜더링해 변환한 html을 웹 브라우저에 넘긴다.
웹 브라우저에서 localhost:8080/hello-api가 서버를 통해 넘어오면 컨트롤러를 찾고 @ResponseBody를 사용했기 때문에 viewResolver가 아닌 HttpMessageConverter가 동작한다. 객체이므로 JsonConverter가 동작하여 객체를 Json 스타일로 바꿔 웹 브라우저에 보낸다.