스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

프로젝트 환경설정

스프링 웹 개발 기초

회원 관리 예제 - 백엔드 개발


프로젝트 환경설정

프로젝트 설정

스크린샷 2022-09-24 오후 6.47.14.png


라이브러리 살펴보기

스크린샷 2022-09-24 오후 7.07.07.png

스프링 부트 라이브러리

테스트 라이브러리


View 환경설정

Welcome Page 만들기

<!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>

thymeleaf 템플릿 엔진

Controller

@Controller
  public class HelloController {
      @GetMapping("hello")
      public String hello(Model model) {
          model.addAttribute("data", "hello!!");
          return "hello";
      }
}

resource/templates/hello.html

<!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>
  </body>
  </html>

동작 환경 그림

스크린샷 2022-09-24 오후 7.57.32.png