Spring boot thymeleaf 적용
2021. 3. 31. 22:42ㆍJava/Spring Boot
1. pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
2. application.properties
spring.thymeleaf.prefix=classpath:templates/
spring.thymeleaf.suffix=.html
#개발모드에는 false 셋팅
spring.thymeleaf.cache=false
spring.thymeleaf.view-names=thymeleaf/*
3. Controller
@GetMapping("/cors.do")
public String cors(Model model) {
# /resources/templates/thymeleaf/cors.html을 찾음
return "thymeleaf/cors";
}