Spring boot 在引导中引用css和js文件
Spring boot 在引导中引用css和js文件,spring-boot,Spring Boot,我试图引用我的css文件,如图所示。由于我的index.html在templates文件夹中,我必须返回1级(../),然后进入static/css/{我想要的文件}。但是,这无法呈现我的css和js文件。我做错了什么?我正在为这个spring boot应用程序使用thymelead模板引擎。请帮忙谢谢Spring Boot和Thymeleaf配合得很好。默认情况下,Spring Boot会查找这些文件夹中的静态资源 /META-INF/resources /resources/ /stati
我试图引用我的css文件,如图所示。由于我的index.html在templates文件夹中,我必须返回1级(../),然后进入static/css/{我想要的文件}。但是,这无法呈现我的css和js文件。我做错了什么?我正在为这个spring boot应用程序使用thymelead模板引擎。请帮忙谢谢Spring Boot和Thymeleaf配合得很好。默认情况下,Spring Boot会查找这些文件夹中的静态资源
/META-INF/resources
/resources/
/static/
/public/
<link rel="stylesheet" href="/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" />
您好,谢谢您的帮助。请问在th:href=“@{/css/bootstrap.min.css}”中添加有什么用?我可以添加href=“/css/bootstrap.min.css”并省略另一个,反之亦然吗?非常感谢much@Desmond欢迎光临。只需查找th:href。这是标准的方式。