【发布时间】:2017-03-26 17:47:18
【问题描述】:
好的,我使用thymleaf开发了一个小型spring boot网站,现在意识到如果我想用maven插件打包所有东西,我不能使用webapp文件夹。
为了解决这个问题,我将所有资源移至 src/main/resources。但是,当我尝试显示任何站点(简单的 RequestMapping 返回一个字符串)时,我不断收到 FileNotFoundExceptions:
这是我得到的错误:
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/index.html]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:157) ~[spring-web-5.0.0.BUILD-SNAPSHOT.jar:5.0.0.BUILD-SNAPSHOT]
at org.thymeleaf.spring5.templateresource.SpringResourceTemplateResource.reader(SpringResourceTemplateResource.java:103) ~[thymeleaf-spring5-3.0.3.M1.jar:3.0.3.M1]
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:223) ~[thymeleaf-3.0.3.RELEASE.jar:3.0.3.RELEASE]
... 75 common frames omitted
然后当 Spring 尝试加载我的错误页面时,我再次收到相同的错误。 已满http://pastebin.com/raw/Csw5akHJ
(是的,我知道只有静态文件夹可用。足够测试了。)
谁能帮帮我?这有点令人沮丧。
【问题讨论】:
标签: java spring-boot