[spring boot] Cannot find template location 에러 해결
spring boot에서는 templates 디렉토리이 비어 있거나 templates 디렉토리가 없으면 에러가 발생한다.
FreeMakerAutoConfiguration 클래스에서 초기화때 체크하는 부분때문에 발생한다.
Caused by: java.lang.IllegalArgumentException: Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false)
at org.springframework.util.Assert.notNull(Assert.java:115)
at org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration.checkTemplateLocationExists(FreeMarkerAutoConfiguration.java:80)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354) ~[spring-beans-4.2.2.BUILD-SNAPSHOT.jar:4.2.2.BUILD-SNAPSHOT]
spring.freemarker.checkTemplateLocation=false 로 설정하면 더 이상 이슈가 발생하지 않는다.
spring: freemarker:
checkTemplateLocation: false