-> 해당 페이지에서 스프링 프로젝트 생성, 다운 후 파일을 ide에서 열기

이런 식으로 ~Application이 맨 위에 제대로 떠 있어야 정상적으로 작동 가능
-동작 확인
1. 기본 메인 클래스 실행
2. ctrl + f5 통해 클래스 실행하고, chrome과 같은 페이지에서 localhost:8080 통해 동작확인

이런 식으로 에러 페이지가 떠야지 정상적으로 처리 된 것
<!DOCTYPE HTML>
<html>
<head>
<title>Hello</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
Hello
<a href="/hello">hello</a>
</body>
</html>
이런 식으로 매우 간단한 html 코드를 작성해서 웰컴페이지 빌드
이후, ctrl+f5로 서버 재시작하면 localhost:8080 통해 hello가 뜨는 것을 확인 가능
체크)) 스프링 부트에는 워낙 방대한 내용이 있음
=> 필요한 걸 찾는 능력이 중요
=> spring.io 사이트 > projects > spring boot > 내 버전의 reference doc > 관련 폴더 하나 골러서 ctrl + f 로 찾기
package hello.hellospring.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HelloController {
@GetMapping("hello") //GET method 실행
public String hello(Model model){
model.addAttribute("data", "hello!!");
return "hello"; //resources 폴더의 hello html 실행, by 'viewResolver'
}
}
//###############################################################
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org"> //불러줘야 실행 가능
<head>
<title>Hello</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p th:text="'안녕하세요. ' + ${data}" >안녕하세요. 손님</p>
// data자리에 controller packet에서 addAttribute로 정의된 hell0!가 나옴
</body>
</html>
