15.1 thymeleaf syntax
In html files, some need to use local css styles, which are loaded using thymeleaf syntax:
First, change the html tag above the head tag:
<html lang="en" xmlns:th="http://www.thymeleaf.org">
Secondly, import the thymeleaf dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
Next, use thymeleaf syntax:
When encountering the local path related to static resources after href or src, you need to modify it. Add th: before the attribute to use thymeleaf format, and change the path after the equal sign to "@{static path (static does not need to be written)}".
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
15.2 Close the template engine
Add: to application.yaml:
spring:
thymeleaf:
cache: false