【发布时间】:2017-10-04 06:58:39
【问题描述】:
我有这段代码,其中tdk是我在SpringBoot文件application.properties中定义的一个公共变量server.contextPath
我想知道有没有办法代替
<head th:replace="tdk/common/header :: common-header" />
类似
<head th:replace="@environment.get('server.contextPath')/common/header :: common-header" />
我正在使用
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>1.5.3.RELEASE</version>
</dependency>
我也试过了:
<head th:replace="~{${@environment.getProperty('serverContextPath') + '/common/header'} :: common-header}" />
结果如下:
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "~{${@environment.getProperty('serverContextPath') + '/common/header'}", template might not exist or might not be accessible by any of the configured Template Resolvers (/tdk/registration/signup:6)
【问题讨论】:
标签: spring-boot thymeleaf