From d21e80d93d976a1ddeebbf337336ab9550fdef61 Mon Sep 17 00:00:00 2001
From: sam-gardner <53271849+sam-gardner@users.noreply.github.com>
Date: Thu, 4 Apr 2024 11:05:48 +0100
Subject: [PATCH] JAVA-32067 Upgrade spring thymeleaf to spring boot 3 (#16129)
---
spring-web-modules/spring-thymeleaf-4/pom.xml | 4 ++--
.../thymeleaf/expression/DinoController.java | 4 ++--
.../thymeleaf/mvcdata/EmailController.java | 19 ++-----------------
.../{templates-3 => templates-2}/form.html | 0
.../{templates-3 => templates-2}/index.html | 0
.../{templates-3 => templates-2}/result.html | 0
.../mvcdata/email-servlet-context.html | 14 --------------
.../mvcdata/email-session-attributes.html | 14 --------------
.../main/resources/templates/url/index.html | 3 ---
.../mvcdata/EmailControllerUnitTest.java | 14 --------------
10 files changed, 6 insertions(+), 66 deletions(-)
rename spring-web-modules/spring-thymeleaf-4/src/main/resources/{templates-3 => templates-2}/form.html (100%)
rename spring-web-modules/spring-thymeleaf-4/src/main/resources/{templates-3 => templates-2}/index.html (100%)
rename spring-web-modules/spring-thymeleaf-4/src/main/resources/{templates-3 => templates-2}/result.html (100%)
delete mode 100644 spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-servlet-context.html
delete mode 100644 spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-session-attributes.html
diff --git a/spring-web-modules/spring-thymeleaf-4/pom.xml b/spring-web-modules/spring-thymeleaf-4/pom.xml
index 2582044c0f..1e6be32801 100644
--- a/spring-web-modules/spring-thymeleaf-4/pom.xml
+++ b/spring-web-modules/spring-thymeleaf-4/pom.xml
@@ -9,9 +9,9 @@
com.baeldung
- parent-boot-2
+ parent-boot-3
0.0.1-SNAPSHOT
- ../../parent-boot-2
+ ../../parent-boot-3
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java
index 6cbf1bae0e..ad2875106d 100644
--- a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java
+++ b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/expression/DinoController.java
@@ -23,7 +23,7 @@ public class DinoController {
model.addAttribute("dinos", dinos);
System.out.println(dinos);
- return "templates-3/index";
+ return "index";
}
@@ -32,7 +32,7 @@ public class DinoController {
model.addAttribute("dinos", new Dino());
- return "templates-3/form";
+ return "form";
}
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java
index 1bfe3f3428..bdf303ef62 100644
--- a/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java
+++ b/spring-web-modules/spring-thymeleaf-4/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java
@@ -1,7 +1,7 @@
package com.baeldung.thymeleaf.mvcdata;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -41,21 +41,6 @@ public class EmailController {
return "mvcdata/email-request-parameters";
}
- @GetMapping("/email/sessionattributes")
- public String emailSessionAttributes(HttpSession httpSession) {
- httpSession.setAttribute("emaildata", emailData);
- return "mvcdata/email-session-attributes";
- }
-
- @GetMapping("/email/servletcontext")
- public String emailServletContext() {
- servletContext.setAttribute("emailsubject", emailData.getEmailSubject());
- servletContext.setAttribute("emailcontent", emailData.getEmailBody());
- servletContext.setAttribute("emailaddress", emailData.getEmailAddress1());
- servletContext.setAttribute("emaillocale", emailData.getEmailLocale());
- return "mvcdata/email-servlet-context";
- }
-
@GetMapping("/email/beandata")
public String emailBeanData() {
return "mvcdata/email-bean-data";
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/form.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/form.html
similarity index 100%
rename from spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/form.html
rename to spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/form.html
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/index.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/index.html
similarity index 100%
rename from spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/index.html
rename to spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/index.html
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/result.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/result.html
similarity index 100%
rename from spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-3/result.html
rename to spring-web-modules/spring-thymeleaf-4/src/main/resources/templates-2/result.html
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-servlet-context.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-servlet-context.html
deleted file mode 100644
index b07573047e..0000000000
--- a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-servlet-context.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- Subject
-
- Content
-
- Email address
-
- Language
-
-
-
\ No newline at end of file
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-session-attributes.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-session-attributes.html
deleted file mode 100644
index 9227171fc6..0000000000
--- a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/mvcdata/email-session-attributes.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- Subject
-
- Content
-
- Email address
-
- Language
-
-
-
\ No newline at end of file
diff --git a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html
index a8ac95aea3..9eabfd8e42 100644
--- a/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html
+++ b/spring-web-modules/spring-thymeleaf-4/src/main/resources/templates/url/index.html
@@ -10,8 +10,5 @@
-