머스태치 html확장자로 이용하기
컨피그를 어노테이션 하고
configureViewResolvers를 오버라이딩
package com.jaybon.securityEx01.config;
import org.springframework.boot.web.servlet.view.MustacheViewResolver;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer{
@Override // 뷰리졸버 설정
public void configureViewResolvers(ViewResolverRegistry registry) {
// 머스태치 리졸버 설정
MustacheViewResolver resolver = new MustacheViewResolver();
resolver.setCharset("utf-8");
resolver.setContentType("text/html;charset=utf-8");
resolver.setPrefix("classpath:/templates/"); // 뷰의 위치
resolver.setSuffix(".html");
registry.viewResolver(resolver);
}
}
---------------------------------
'Server > Spring Boot' 카테고리의 다른 글
spring boot // 구글 oauth 설정 (0) | 2020.08.11 |
---|---|
spring boot // ROLE 만들기 (0) | 2020.08.11 |
spring boot // validation을 AOP로 사용하기 (0) | 2020.08.11 |
spring boot // validation 어노테이션 (0) | 2020.08.11 |
spring boot // JWT 만들기 (0) | 2020.08.07 |