【发布时间】:2014-08-17 19:55:27
【问题描述】:
我是第一次使用 Thymeleaf 视图层。我已将模板的默认位置更改为WEB-INF/views,并且我的所有静态资源都位于/resources/css/ 目录下,这些资源使用spring 资源处理程序映射到/css/** 模式。我有一个使用在运行时失败的 CSS 文件的页面。我得到以下异常。如果我删除 <link> 标签,页面加载时没有应用任何 CSS。以下是我在页面中的链接
任何指针将不胜感激。
<link rel="stylesheet" href="/resources/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}">
资源处理程序:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/css/**").addResourceLocations("/resources/css/");
registry.addResourceHandler("/js/**").addResourceLocations("/resources/js/");
}
例外:
javax.servlet.ServletException: Filter execution threw an exception
org.springframework.boot.context.web.ErrorPageFilter.handleException(ErrorPageFilter.java:135)
org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:104)
org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:85)
org.springframework.boot.context.web.ErrorPageFilter.handleException(ErrorPageFilter.java:135)
org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:104)
org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:85)
org.springframework.boot.context.web.ErrorPageFilter.handleException(ErrorPageFilter.java:135)
【问题讨论】:
-
stacktrace 的摘录并未指出问题所在。你能发布完整的堆栈跟踪吗?
标签: spring spring-mvc spring-security thymeleaf