使用FreeMarker模板时出现配置错误,导致出现错误。

huangapple go评论92阅读模式
英文:

using of freemarker template error occurs configuration failed

问题

@Autowired
private Configuration freemarkerConfig;

出现以下异常

通过字段 'freemarkerConfig' 表达的不满足的依赖关系
嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException: 在类路径资源 [org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.class] 中定义的 'freeMarkerConfiguration' bean 的创建错误通过方法 'freeMarkerConfiguration' 的参数 0 表达的不满足的依赖关系
嵌套异常是 org.springframework.beans.factory.BeanCreationException: 在类路径资源 [org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.class] 中定义的 'freeMarkerConfigurer' bean 的创建错误调用初始化方法失败
嵌套异常是 freemarker.core.Configurable$UnknownSettingException: 未知的 FreeMarker 配置设置"recognize_standard_file_extensions"
英文:
@Autowired
private Configuration freemarkerConfig;

Getting the following exception,

Unsatisfied dependency expressed through field 'freemarkerConfig';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'freeMarkerConfiguration' defined in class path resource [org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.class]: Unsatisfied dependency expressed through method 'freeMarkerConfiguration' parameter 0; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'freeMarkerConfigurer' defined in class path resource [org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.class]: Invocation of init method failed; 
nested exception is freemarker.core.Configurable$UnknownSettingException: Unknown FreeMarker configuration setting: "recognize_standard_file_extensions"

答案1

得分: 1

我遇到了相同的问题,请确保您正在自动装配正确的 FreeMarker Configuration,或者使用

@Autowired
private freemarker.template.Configuration freeMarker;
英文:

I had the same issue, make sure you are autowiring correct FreeMarker Configuration, or use

@Autowired
private freemarker.template.Configuration freeMarker;

huangapple
  • 本文由 发表于 2020年7月24日 14:49:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/63068292.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定