java - Spring boot freemarker -
i exception when try import jsptaglibs in spring boot application.
freemarker.template.templatemodelexception: no mapping defined http://www.springframework.org/tags/form
hear part of ftl file, when try import it.
<#import "/spring.ftl" spring/> <#assign form=jsptaglibs["http://www.springframework.org/tags/form"] />
get problem when starting application spring boot app, works if deployed on standalone tomcat war file.
any ideas ?
you need add code below give templates path.
@configuration public class emailconfiguration { @bean(name ="freemarkerconfig") public freemarkerconfigurer getfreemarkerconfig() { freemarkerconfigurer configurer = new freemarkerconfigurer(); configurer.settemplateloaderpath("**classpath:mail**/"); map<string, object> map = new hashmap<>(); map.put("xml_escape", new xmlescape()); configurer.setfreemarkervariables(map); return configurer; } }
Comments
Post a Comment