簡體   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