웹 브라우저에서 localhost:8080/hello-static.html
을 내장 톰캣 서버로 요청
↓
1. 먼저 스프링 컨테이너에서 hello-static
관련 컨트롤러 찾음
2. 관련 컨틀롤러가 없을시에, resources: static/hello-static.html
을 찾는다.
↓
hello-static-html
을 웹 브라우저에 리턴한다.
MVC: Model, View, Controller
@Controller
public class HelloController {
@GetMapping("hello")
public String hello(Model model){
model.addAttribute("data", "hello!!");
return "hello";
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>static content</title>
</head>
<body>
정적 컨텐츠입니다.
</body>
</html>
웹 브라우저에서 localhost:8080/hello-api
요청
↓
톰캣 내장 서버
↓
Controller
에서 찾는데, @ResponsBody
가 붙어있으면 HttpMessageConverter
가 실행된다.
↓
객체
가 return되는 경우 → JsonConverter
실행
문자열
이 return되는 경우 → StringConverter
실행