很奇怪,今天把网页放到template下面静态资源就不显示。
看了网上说是thymleaf的引入问题,那我寻思静态人家网页里面报的是404,明显是找不到了资源。查了一下,原来是application.propertities里面要配置静态资源的位置。
//表示所有的访问都经过静态资源路径
spring.mvc.static-path-pattern=/static/**
//spring.resources.static-locations自定义Springboot前端静态资源的位置。默认Springboot将从如下位置,按优先级查找静态资源:
spring.resources.static-locations=classpath:/static,classpath:/public,classpath:/resources,classpath:/META-INF/resources