I am trying to load Freemarker templates from multiple locations using Spring MVC. This project is developed using Intellij.
I have two maven projects:
my-website: the main maven project, contains customised templates at
WEB-INF/ftl, example,WEB-INF/ftl/landing/login.ftlgeneric-templates: that contains the generic freemarker templates at
WEB-INF/ftl, example,WEB-INF/ftl/landing/login.ftl
The idea is for Freemarker, for example, to search for landing/login in 'my-website' and if it is not found then search it in 'generic-templates' landing/login.
According to the freemarker template loader documentation the freemarker.xml should look like:
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPaths" value="generic-templates://WEB-INF/ftl/,/WEB-INF/ftl/" />
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="cache" value="true"/>
<property name="prefix" value=""/>
<property name="suffix" value=".ftl"/>
</bean>
but I am obviously doing something very wrong because it is not working: the files for generic-templates are not found.
Any idea how can I make this work ? (other approaches that accomplish the same goal are welcomed)
How can I debug it ?