Upgrading a Spring Boot project from 2.x to 3.x using Thymeleaf HTML pages. Having a problem when current fragment expression includes a text modifier.
Set in application.properties file:
spring.thymeleaf.mode=HTML
Current POM:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<relativePath/>
</parent>
<!-- Thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
</dependency>
SB 2.x version of fragment:
<head th:replace="fragments/global/head :: head_default(title='Home')"></head>
<body>
<div class="header-nav-container">
<header th:replace="fragments/global/header :: header_default"></header>
<nav th:replace="fragments/global/nav :: nav_default(active='Home',subactive='Home')"> </nav>
</div>
SB 3.x version of fragment:
<head th:replace="~{fragments/global/head :: head_default(~{title='Home'})}"></head>
<body>
<div class="header-nav-container">
<header th:replace="~{fragments/global/header :: header_default}"></header>
<nav th:replace="~{fragments/global/nav :: nav_default(~{active='Home'},~{subactive='Home'})}"></nav>
</div>
I keep getting runtime exceptions for the extended text parts:
(~{title='Home'}) and similar for (~{active='Home'},~{subactive='Home'})
Caused by: org.attoparser.ParseException: Error resolving fragment: "~{'fragments/global/head' :: head_default ('_arg0'=~{'title='Home''})}": template or fragment could not be resolved (template: "index" - line 8, col 11)
I have searched and tried the few variations I could find for a resolution but it keeps eluding me.