AOP
console 창에서
개발의 과정에서 에러를 컨트롤할수 있는 Flow management
logger
스프링부트 vs 스프링프레임워크 (maven)
THYMELEAF(타임리프) : NONWEB SERVICE
Generate - 압축풀기 - import -Existing Maven Projects
언어 확인하기
Run on server가 아니라 JAVA Application으로 실행
외부서버를 붙여오는 것이 아니라 자체 웹서버가 구성됨
package com.code.springboot.demo.mybootapp.rest;
import java.time.LocalDateTime;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class myRestController {
@GetMapping("/")
public String sayHello() {
return "Hello Boot~!! Time on server is " + LocalDateTime.now();
}
}
Error 잡기
cmd창
netstat -ano | findstr 8080
taskkill /F /pid 4404
com.code.springboot.thymeleaf.controller
DemoController.java
컨트롤러 작성
package com.code.springboot.thymeleaf.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class DemoController {
@GetMapping("/hello")
public String sayHello(Model theModel) {
theModel.addAttribute("theDate", new java.util.Date());
return "helloworld";
}
}
src/main/resources/templates
helloworld.html
뷰단 작성
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
Time on Server(p) : <p th:text="${theDate}"> </p>
<p th:text = "'Time on Server:::' + ${theDate}"/>
Time on Server(span) : <span th:text="${theDate}"></span>
</body>
</html>