1
votes

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Cannot find template location(s): [ServletContext resource [/templates]] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false)

I kept ftl files in templates folder in resources.

In application.properties I also added these lines

spring.freemarker.template-loader-path= /templates

1

1 Answers

3
votes

You have overridden the default Spring Boot property value of:

spring.freemarker.template-loader-path=classpath:/templates

and now you are pointing to a file system directory /templates. Remove your custom property to load the FTL files from the default classpath location.