I have this piece of code where tdk is a shared variable that I defined in the SpringBoot application.properties file called server.contextPath
I would like to know if there is a way to replace it with
<head th:replace="tdk/common/header :: common-header" />
something like
<head th:replace="@environment.get('server.contextPath')/common/header :: common-header" />
I use
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> <version>1.5.3.RELEASE</version> </dependency>
I also tried:
<head th:replace="~{${@environment.getProperty('serverContextPath') + '/common/header'} :: common-header}" />
with this result:
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
En NuNYet de Can CalΓadA
source share