英文:
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;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论