[昨日实践]springboot1.5.x中引用thymeleaf3.0版本的一种简单实现

       使用springboot1.5.x建立项目时,选择使用的thymeleaf时,最终对thymeleaf依赖的版本依然是2.x,想使用3.x版本,其中的一种处理方式是:

       在项目的pom.xml中的<properties>段内,重新定义如下的几个属性:

	<thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
	<thymeleaf-layout-dialect.version>2.4.1</thymeleaf-layout-dialect.version>
	<thymeleaf-extras-springsecurity4.version>3.0.4.RELEASE</thymeleaf-extras-springsecurity4.version>

       即可实现对thymeleaf3.x的引用。

       详细的原因:

       1、使用springboot1.5.x建立项目后,默认的模板在pom.xml文件中,会有如下的段:

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.20.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

       spring-boot-starter-parent-1.5.20.RELEASE.pom依赖的是spring-boot-dependencies-1.5.20.RELEASE.pom的内容,在后者的定义文件(查看地址),可以看到,有关于thymeleaf的属性定义中下:

<thymeleaf.version>2.1.6.RELEASE</thymeleaf.version>
<thymeleaf-extras-springsecurity4.version>2.1.3.RELEASE</thymeleaf-extras-springsecurity4.version>		<thymeleaf-extras-conditionalcomments.version>2.1.2.RELEASE</thymeleaf-extras-conditionalcomments.version>
<thymeleaf-layout-dialect.version>1.4.0</thymeleaf-layout-dialect.version>
<thymeleaf-extras-data-attribute.version>1.3</thymeleaf-extras-data-attribute.version>
<thymeleaf-extras-java8time.version>2.1.0.RELEASE</thymeleaf-extras-java8time.version>

      2、利用maven模块属性重定义可覆盖父属性定义的特性,实现属性值的覆盖。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值