【发布时间】:2014-10-21 18:36:37
【问题描述】:
我使用这样的片段:
@RequestMapping(value="/fragment/nodeListWithStatus", method= RequestMethod.GET)
public String nodeListWithStatus(Model model) {
// status der nodes
model.addAttribute("nodeList", nodeService.getNodeListWithOnlineStatus());
return "/fragments :: nodeList";
}
模板位于 /src/main/resources/templates。从 IntelliJ 启动应用程序时,这工作正常。 一旦我创建了一个 .jar 并启动它,上面的代码就不再起作用了。错误:
[2014-10-21 20:37:09.191] log4j - 7941 ERROR [http-nio-666-exec-2] --- TemplateEngine: [THYMELEAF][http-nio-666-exec-2] Exception processing template "/fragments": Error resolving template "/fragments", template might not exist or might not be accessible by any of the configured Template Resolvers
当我用 winrar 打开 .jar 时,我看到 /templates/fragments.html - 所以它似乎在那里。
我的 pom.xml 有这部分用于构建 jar(Maven 清理,安装):
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>de.filth.Application</mainClass>
<layout>JAR</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
谁能告诉我我在这里做错了什么?
谢谢!
【问题讨论】:
标签: spring fragment spring-boot thymeleaf