title: SpringBoot+Thymeleaf配置外部静态资源访问
date: 2019-06-23 10:40:29
categories:
- Spring Boot
tags: - thymeleaf
#####配置外部资源访问(html、css、js)
我的thymeleaf配置:
# thymeleaf
# html目录配置
spring.thymeleaf.prefix=file:d:/tt/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.cache=false
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.enabled=true
spring.thymeleaf.encoding=UTF-8
# 一代填 spring.thymeleaf.mode=HTML5
spring.thymeleaf.mode=HTML
css与js静态资源访问通过实现WebMvcConfigurer来配置:
如下配置文件的方式无法访问到:
spring.mvc.static-path-pattern=/**
#spring.resources.static-locations= classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:d:/tt/static/
MVCConfig:
@Configuration //申明这是一个配置
@EnableWebMvc
public class MySrpingMVCConfig imple