简体   繁体   English

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

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

I am currently testing using Spring-Boot to deploy a Freemarker application. 我目前正在测试使用Spring-Boot部署Freemarker应用程序。 I fact my simple test is working fine. 我的简单测试工作正常。 But in my log I see the following exception and I wonder what it could be: 但是在我的日志中,我看到以下异常,我想知道这可能是什么:

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]

But my templates are correctly used. 但是我的模板已正确使用。 Is that exception "normal"? 那是“正常”的例外吗? Note that we are not using the Spring-Boot parent pom. 请注意,我们没有使用Spring-Boot父pom。 We are using our own parent. 我们正在使用自己的父母。

It's a DEBUG log. 这是一个调试日志。 I should think that makes it ignorable. 我应该认为这使其可忽略。

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

Add configuration below would solve the problem! 在下面添加配置将解决问题! 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