springboot-thymeleaf公共css/js 引入失败问题解决方案
目前使用spring boot 框架时,大多使用得都是1.5.*左右的版本。
在以用thymeleaf 前端框架时候,总是会或多或少出现一些问题。
现在对该功能做一次系统全面的步骤解说:
pom.xml配置thymeleaf jar包
我们先以用thymeleaf相关的jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
引用完成后,查看pom.xml中的Dependency Hierarchy,可以看到thymeleaf中版本号为2.1.*
我们需要在标签中添加一下代码:
<properties>
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.0.4</thymeleaf-layout-dialect.version>
</properties>
然后可以看到thymeleaf对应的jar包版本改为3.0.2
功创建公共文件commonCss.html
<!DOCTYPE html>
<