Springboot官方推荐的Themeleaf提供自动渲染模板页功能:
public class ThymeleafProperties {
private static final Charset DEFAULT_ENCODING;
public static final String DEFAULT_PREFIX = "classpath:/templates/";
public static final String DEFAULT_SUFFIX = ".html";
}
同时我们需要在porn.xml中引入Themeleaf的依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.1.11.RELEASE</version>
</dependency>
SpringBoot的静态资源默认会从
classpath:/resources,clsspath:/static/,classpath:/public/,classpath:/META-INF/resources/四个地址下寻找:
registry.addResourceHandler("/**").addResourceLocation(
"classpath:/META-INF/resources/","c