Open snaag opened 1 year ago
localhost:8080
접근 시 바로 나오는 페이지@Controller
public class HelloController {
@GetMapping("hello")
public String hello(Model model) {
model.addAttribute("data", "hello!!");
return "hello";
}
}
<!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> <!-- A: 동적으로 값 넘어감 -->
</body>
</html>
A
data: hello!
값이 넘어간 것templates/ +{ViewName}+ .html
를 찾아서 띄워줌implementation 'org.springframework.boot:spring-boot-devtools'
을 추가하면 해당 html 파일만 recompile 해도 적용이 됨
./gradlew build
-> build 폴더 생김
./gradlew clean build
-> build 폴더 삭제 후 다시 빌드cd build/libs
-> 결과물 있는 파일로 이동java -jar xx.jar
-> jar 파일 실행https://crazykim2.tistory.com/631