我有CSS和Thymeleaf的问题.
在我的Spring启动应用程序中,我有这样的结构:
现在,我的html页面名为ErrorPage,css文件名为Layout.css,使用Thymeleaf,我在ErrorPage的头部:
<link href="../css/Layout.css" th:href="@{css/Layout.css}" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
但这不起作用.
我究竟做错了什么?
我尝试使用Thymeleaf在Spring Boot中将CSS添加到我的HTML页面,在静态文件夹中添加CSS文件并以这种方式链接:
<link rel="stylesheet" th:href="@{/css/home.css}" href="../../css/home.css" />
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
我想停止访问URL中的CSS和js,所以我将此方法添加到我的安全配置中:
@Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/resources/static/**"); // #3
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我什么是我的错误或是否需要任何配置?