繁体   English   中英

Spring-Boot + Velocity在启动时生成异常

[英]Spring-Boot + Velocity generate exception at startup

我目前正在测试使用Spring-Boot部署Freemarker应用程序。 我的简单测试工作正常。 但是在我的日志中,我看到以下异常,我想知道这可能是什么:

2014-08-14 15:03:26.774 +0000 DEBUG         [                main]    [o.s.w.servlet.view.freemarker.FreeMarkerConfigurer:346] -  Cannot resolve template loader path [classpath:/templates/] to [java.io.File]: using SpringTemplateLoader as fallback  
java.io.FileNotFoundException: class path resource [templates/] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/htmlconverter.jar!/templates/
at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:207) ~[spring-core-4.0.6.RELEASE.jar:4.0.6.RELEASE]

但是我的模板已正确使用。 那是“正常”的例外吗? 请注意,我们没有使用Spring-Boot父pom。 我们正在使用自己的父母。

这是一个调试日志。 我应该认为这使其可忽略。

您必须在/ src / main / resources /中创建一个/ templates文件夹,并且其中必须包含速度文件,或者您可以跳过@EnableAutoConfiguration中带有exclude的自动配置

在下面添加配置将解决问题! spring.velocity.prefer-file-system-access=false spring.velocity.prefix=/templates

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM