[英]How to add css to a Spring Boot project?
When I include ZC7A628CBA22E28EB17B5F5C6AE2A266AZ it throws an error osweb.servlet.PageNotFound: No match for GET /css/s.ZC7A628CBA22E28EB17B5F5C6AE2A266AZ In spring sequiriti I have added
.antMatchers("/css/**").permitAll()
html中的鏈接:
<link rel="stylesheet" type="text/css" th:href="@{/css/s.css}">
架構文件夾:
-Resources
-static
-css
-s.css
-templates
-main
-home.html
嘗試添加這樣的東西
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/css/**")
.addResourceLocations("classpath:/static/css/");
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.