[英]Thymeleaf + Spring Boot: Error resolving template
我有一個基本的SpringBoot應用程序。 使用Spring Initializer,嵌入式Tomcat,Thymeleaf模板引擎和包作為可執行的JAR文件。
我在application.properties
有這個屬性
server.contextPath=/pecador
server.port=5678
運行Eclipse我可以訪問應用程序,一切都很好
http://localhost:5678/pecador/login
但是當我在服務器中部署應用程序並使用以下命令運行它時:
sudo nohup java -jar pecadorCloudApp-0.0.1-SNAPSHOT.jar & /tmp 2>> /dev/null >> /dev/null &
我試着http://149.152.231.117:5678/pecador/login
我收到了這個錯誤:
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/pecador/login/login", template might not exist or might not be accessible by any of the configured Template Resolvers
並解壓縮模板在那里,在:
pecadorAPP.jar/BOOT-INF/classes/templates/pecador/login/login.html
看起來您正在使用前導斜杠( /
)返回視圖名稱。 只需返回pecador/login/login
,它就可以在兩種環境中運行。
請查看: https : //github.com/spring-projects/spring-boot/issues/1744
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.