From 4ba7a2d890287768e1306598991f7c973e798c7b Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Wed, 22 Dec 2021 15:16:34 +0530 Subject: [PATCH 1/3] JAVA-8291 : Split or move spring-thymeleaf-2 module --- .../spring-thymeleaf-2/README.md | 3 - .../resources/templates-2/participants.html | 32 --------- .../spring-thymeleaf-5/README.md | 10 +++ spring-web-modules/spring-thymeleaf-5/pom.xml | 67 +++++++++++++++++++ .../com/baeldung/thymeleaf/Application.java | 11 +++ .../baeldung/thymeleaf/ThymeleafConfig.java | 0 .../thymeleaf/mvcdata/BeanConfig.java | 0 .../thymeleaf/mvcdata/EmailController.java | 0 .../mvcdata/repository/EmailData.java | 0 .../templatedir/HelloController.java | 0 .../src/main/resources/application.properties | 1 + .../src/main/resources/templates-2/hello.html | 0 .../templates/mvcdata/email-bean-data.html | 0 .../mvcdata/email-model-attributes.html | 0 .../mvcdata/email-request-parameters.html | 0 .../mvcdata/email-servlet-context.html | 0 .../mvcdata/email-session-attributes.html | 0 .../mvcdata/EmailControllerUnitTest.java | 0 .../src/test/resources/logback-test.xml | 12 ++++ 19 files changed, 101 insertions(+), 35 deletions(-) delete mode 100644 spring-web-modules/spring-thymeleaf-2/src/main/resources/templates-2/participants.html create mode 100644 spring-web-modules/spring-thymeleaf-5/README.md create mode 100644 spring-web-modules/spring-thymeleaf-5/pom.xml create mode 100644 spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/Application.java rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/java/com/baeldung/thymeleaf/ThymeleafConfig.java (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/java/com/baeldung/thymeleaf/mvcdata/BeanConfig.java (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/java/com/baeldung/thymeleaf/mvcdata/repository/EmailData.java (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/java/com/baeldung/thymeleaf/templatedir/HelloController.java (100%) create mode 100644 spring-web-modules/spring-thymeleaf-5/src/main/resources/application.properties rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/resources/templates-2/hello.html (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/resources/templates/mvcdata/email-bean-data.html (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/resources/templates/mvcdata/email-model-attributes.html (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/resources/templates/mvcdata/email-request-parameters.html (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/resources/templates/mvcdata/email-servlet-context.html (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/main/resources/templates/mvcdata/email-session-attributes.html (100%) rename spring-web-modules/{spring-thymeleaf-2 => spring-thymeleaf-5}/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java (100%) create mode 100644 spring-web-modules/spring-thymeleaf-5/src/test/resources/logback-test.xml diff --git a/spring-web-modules/spring-thymeleaf-2/README.md b/spring-web-modules/spring-thymeleaf-2/README.md index a8c067a443..488a0bdc2d 100644 --- a/spring-web-modules/spring-thymeleaf-2/README.md +++ b/spring-web-modules/spring-thymeleaf-2/README.md @@ -5,13 +5,10 @@ This module contains articles about Spring with Thymeleaf ## Relevant Articles: - [Working with Enums in Thymeleaf](https://www.baeldung.com/thymeleaf-enums) -- [Changing the Thymeleaf Template Directory in Spring Boot](https://www.baeldung.com/spring-thymeleaf-template-directory) - [Spring Request Parameters with Thymeleaf](https://www.baeldung.com/spring-thymeleaf-request-parameters) - [Thymeleaf lists Utility Object](https://www.baeldung.com/thymeleaf-lists-utility) - [Spring Path Variables with Thymeleaf](https://www.baeldung.com/spring-thymeleaf-path-variables) - [Working with Arrays in Thymeleaf](https://www.baeldung.com/thymeleaf-arrays) - [Working with Boolean in Thymeleaf](https://www.baeldung.com/thymeleaf-boolean) - [Working With Custom HTML Attributes in Thymeleaf](https://www.baeldung.com/thymeleaf-custom-html-attributes) -- [How to Create an Executable JAR with Maven](https://www.baeldung.com/executable-jar-with-maven) -- [Spring MVC Data and Thymeleaf](https://www.baeldung.com/spring-mvc-thymeleaf-data) - [[<-- prev]](/spring-thymeleaf) diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates-2/participants.html b/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates-2/participants.html deleted file mode 100644 index f7e017e777..0000000000 --- a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates-2/participants.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - -

Enter participant

-
- - - - - -
- - -

User Details

-

Details for user [[${id}]] ...

-
- -

Users

- -

- User [[${userId}]] -

-
- - diff --git a/spring-web-modules/spring-thymeleaf-5/README.md b/spring-web-modules/spring-thymeleaf-5/README.md new file mode 100644 index 0000000000..7bbaa8b4db --- /dev/null +++ b/spring-web-modules/spring-thymeleaf-5/README.md @@ -0,0 +1,10 @@ +## Spring Thymeleaf + +This module contains articles about Spring with Thymeleaf + +## Relevant Articles: + +- [Changing the Thymeleaf Template Directory in Spring Boot](https://www.baeldung.com/spring-thymeleaf-template-directory) +- [How to Create an Executable JAR with Maven](https://www.baeldung.com/executable-jar-with-maven) +- [Spring MVC Data and Thymeleaf](https://www.baeldung.com/spring-mvc-thymeleaf-data) +- [[<-- prev]](/spring-thymeleaf) diff --git a/spring-web-modules/spring-thymeleaf-5/pom.xml b/spring-web-modules/spring-thymeleaf-5/pom.xml new file mode 100644 index 0000000000..14062d60f3 --- /dev/null +++ b/spring-web-modules/spring-thymeleaf-5/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + spring-thymeleaf-5 + spring-thymeleaf-5 + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.apache.maven.plugins + maven-war-plugin + + + org.apache.tomcat.maven + tomcat7-maven-plugin + ${tomcat7-maven-plugin.version} + + + tomcat-run + + exec-war-only + + package + + / + false + webapp.jar + utf-8 + + + + + + spring-thymeleaf-5 + + + + 2.2 + + + \ No newline at end of file diff --git a/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/Application.java b/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/Application.java new file mode 100644 index 0000000000..2ccca82497 --- /dev/null +++ b/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/Application.java @@ -0,0 +1,11 @@ +package com.baeldung.thymeleaf; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/ThymeleafConfig.java b/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/ThymeleafConfig.java similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/ThymeleafConfig.java rename to spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/ThymeleafConfig.java diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/mvcdata/BeanConfig.java b/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/mvcdata/BeanConfig.java similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/mvcdata/BeanConfig.java rename to spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/mvcdata/BeanConfig.java diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java b/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java rename to spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/mvcdata/EmailController.java diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/mvcdata/repository/EmailData.java b/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/mvcdata/repository/EmailData.java similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/mvcdata/repository/EmailData.java rename to spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/mvcdata/repository/EmailData.java diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/templatedir/HelloController.java b/spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/templatedir/HelloController.java similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/java/com/baeldung/thymeleaf/templatedir/HelloController.java rename to spring-web-modules/spring-thymeleaf-5/src/main/java/com/baeldung/thymeleaf/templatedir/HelloController.java diff --git a/spring-web-modules/spring-thymeleaf-5/src/main/resources/application.properties b/spring-web-modules/spring-thymeleaf-5/src/main/resources/application.properties new file mode 100644 index 0000000000..b09232bb1b --- /dev/null +++ b/spring-web-modules/spring-thymeleaf-5/src/main/resources/application.properties @@ -0,0 +1 @@ +#spring.thymeleaf.prefix=classpath:/templates-2/ \ No newline at end of file diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates-2/hello.html b/spring-web-modules/spring-thymeleaf-5/src/main/resources/templates-2/hello.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/resources/templates-2/hello.html rename to spring-web-modules/spring-thymeleaf-5/src/main/resources/templates-2/hello.html diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-bean-data.html b/spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-bean-data.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-bean-data.html rename to spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-bean-data.html diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-model-attributes.html b/spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-model-attributes.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-model-attributes.html rename to spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-model-attributes.html diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-request-parameters.html b/spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-request-parameters.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-request-parameters.html rename to spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-request-parameters.html diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-servlet-context.html b/spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-servlet-context.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-servlet-context.html rename to spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-servlet-context.html diff --git a/spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-session-attributes.html b/spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-session-attributes.html similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/main/resources/templates/mvcdata/email-session-attributes.html rename to spring-web-modules/spring-thymeleaf-5/src/main/resources/templates/mvcdata/email-session-attributes.html diff --git a/spring-web-modules/spring-thymeleaf-2/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java b/spring-web-modules/spring-thymeleaf-5/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java similarity index 100% rename from spring-web-modules/spring-thymeleaf-2/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java rename to spring-web-modules/spring-thymeleaf-5/src/test/java/com/baeldung/thymeleaf/mvcdata/EmailControllerUnitTest.java diff --git a/spring-web-modules/spring-thymeleaf-5/src/test/resources/logback-test.xml b/spring-web-modules/spring-thymeleaf-5/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..8d4771e308 --- /dev/null +++ b/spring-web-modules/spring-thymeleaf-5/src/test/resources/logback-test.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + \ No newline at end of file From 197ed5936971c7594750966108425d8c8cdcea0b Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Wed, 22 Dec 2021 15:50:59 +0530 Subject: [PATCH 2/3] Remove unused code --- spring-web-modules/spring-thymeleaf-5/pom.xml | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/spring-web-modules/spring-thymeleaf-5/pom.xml b/spring-web-modules/spring-thymeleaf-5/pom.xml index 14062d60f3..e7c54d83c9 100644 --- a/spring-web-modules/spring-thymeleaf-5/pom.xml +++ b/spring-web-modules/spring-thymeleaf-5/pom.xml @@ -31,32 +31,6 @@ - - - org.apache.maven.plugins - maven-war-plugin - - - org.apache.tomcat.maven - tomcat7-maven-plugin - ${tomcat7-maven-plugin.version} - - - tomcat-run - - exec-war-only - - package - - / - false - webapp.jar - utf-8 - - - - - spring-thymeleaf-5 From 73d4b9af4bc5205ac76168260ef7874e5f83c943 Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Fri, 24 Dec 2021 14:20:34 +0530 Subject: [PATCH 3/3] Adding new module to parent pom --- spring-web-modules/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-web-modules/pom.xml b/spring-web-modules/pom.xml index cc54a9132b..d66d9cb35a 100644 --- a/spring-web-modules/pom.xml +++ b/spring-web-modules/pom.xml @@ -45,6 +45,7 @@ spring-thymeleaf-2 spring-thymeleaf-3 spring-thymeleaf-4 + spring-thymeleaf-5 spring-boot-jsp spring-web-url