我目前正在测试使用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。我们正在使用自己的父母。
答案 0 :(得分:0)
这是一个DEBUG日志。我认为这让它变得可以忽略。
答案 1 :(得分:0)
你必须在/ src / main / resources /中创建一个/ templates文件夹,它必须包含速度文件,否则你可以在@EnableAutoConfiguration
中跳过带有exclude的自动配置答案 2 :(得分:0)
下面添加配置可以解决问题!
spring.velocity.prefer-file-system-access=false
spring.velocity.prefix=/templates