스프링 입문

Ch01. 프로젝트 환경 설정 - View 환경설정

webmaster 2021. 11. 24. 16:14
728x90

SpringBoot

SpringBoot 같은 경우 아무런 설정이 없을 경우 resources/static/index.html 파일을 Welcome Page로 설정해 준다.

Spring은 범위가 굉장히 크기 때문에 필요한 것을 잘 찾아서 사용하는 것도 굉장히 중요하다.

 

Index of /spring-boot

 

docs.spring.io

해당 페이지에서 원하는 내용을 찾는 방법을 연습하여야 한다.

 

Thymeleaf

Integrations galore Eclipse, IntelliJ IDEA, Spring, Play, even the up-and-coming Model-View-Controller API for Java EE 8. Write Thymeleaf in your favourite tools, using your favourite web-development framework. Check out our Ecosystem to see more integrati

www.thymeleaf.org

 

Serving Web Content with Spring MVC

this guide is designed to get you productive as quickly as possible and using the latest Spring project releases and techniques as recommended by the Spring team

spring.io

 

Spring Boot Reference Documentation

This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe

docs.spring.io

thymeleaf 템플릿 엔진

  • 프로그래밍 언어를 사용하여 동적으로 바뀌는 페이지를 전송해 줄 수 있다.
  • Controller를 생성후 모델을 띄운다.
  • hello.html
    ${data} 부분이 hello로 치환된다.
  • 동작환경
  • 컨트롤러에서 리턴 값으로 문자를 반환하면 뷰 리졸버( viewResolver )가 화면을 찾아서 처리한다.
    • 스프링 부트 템플릿 엔진 기본 viewName 매핑
    • resources:templates/ +{ViewName}+. html
  • spring-boot-devtools 라이브러리를 추가하면, html 파일을 컴파일만 해주면 서버 재시작 없이 View 파일 변경이 가능하다

 

728x90