From 32bdc0690f44f475e3348c28092a47f8ac8b9e37 Mon Sep 17 00:00:00 2001 From: bsmahi Date: Thu, 18 Aug 2022 07:05:28 +0530 Subject: [PATCH] Upgrade to Spring Boot 3.0.0-M4 --- .gitignore | 1 + Step01.md | 15 ++- Step02.md | 15 ++- Step03.md | 15 ++- Step04.md | 15 ++- Step05.md | 15 ++- Step06.md | 15 ++- Step07.md | 18 +-- Step08.md | 21 ++-- Step09.md | 21 ++-- Step10.md | 21 ++-- Step11.md | 24 ++-- Step13.md | 24 ++-- Step14.md | 48 ++++---- Step15.md | 52 ++++----- Step17.md | 64 +++++------ Step20.md | 70 ++++++------ Step24.md | 73 +++++++------ Step25.md | 76 ++++++------- Step27.md | 70 ++++++------ pom.xml | 19 ++-- .../filter/LoginRequiredFilter.java | 43 ++++---- .../com/in28minutes/login/LoginService.java | 9 +- .../com/in28minutes/login/LoginServlet.java | 46 ++++---- .../com/in28minutes/logout/LogoutServlet.java | 11 +- .../com/in28minutes/todo/AddTodoServlet.java | 30 ++--- .../in28minutes/todo/DeleteTodoServlet.java | 13 +-- .../com/in28minutes/todo/ListTodoServlet.java | 13 +-- src/main/java/com/in28minutes/todo/Todo.java | 103 +++++++++--------- .../com/in28minutes/todo/TodoService.java | 31 +++--- 30 files changed, 526 insertions(+), 465 deletions(-) diff --git a/.gitignore b/.gitignore index 0c4ca8e..b13cfc7 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ mvnw target *.DS_Store +.idea # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* diff --git a/Step01.md b/Step01.md index de90a25..93a74a0 100644 --- a/Step01.md +++ b/Step01.md @@ -12,7 +12,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / diff --git a/Step02.md b/Step02.md index 03af3eb..063d7de 100644 --- a/Step02.md +++ b/Step02.md @@ -17,7 +17,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -28,17 +28,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / diff --git a/Step03.md b/Step03.md index e7d42bf..0d6405b 100644 --- a/Step03.md +++ b/Step03.md @@ -16,7 +16,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -27,17 +27,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1/version> true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / diff --git a/Step04.md b/Step04.md index 0dd7842..9f8b1db 100644 --- a/Step04.md +++ b/Step04.md @@ -12,7 +12,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / diff --git a/Step05.md b/Step05.md index 386f5bc..440466d 100644 --- a/Step05.md +++ b/Step05.md @@ -12,7 +12,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / diff --git a/Step06.md b/Step06.md index 37e4949..4b03234 100644 --- a/Step06.md +++ b/Step06.md @@ -12,7 +12,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / diff --git a/Step07.md b/Step07.md index c7378d6..86616cb 100644 --- a/Step07.md +++ b/Step07.md @@ -12,7 +12,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -68,11 +73,10 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - @WebServlet(urlPatterns = "/login.do") public class LoginServlet extends HttpServlet { - private LoginService service = new LoginService(); + private final LoginService userValidationService = new LoginService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) diff --git a/Step08.md b/Step08.md index 76c9a8e..d324eeb 100644 --- a/Step08.md +++ b/Step08.md @@ -12,7 +12,7 @@ javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -74,8 +79,8 @@ import webapp.todo.TodoService; @WebServlet(urlPatterns = "/login.do") public class LoginServlet extends HttpServlet { - private LoginService service = new LoginService(); - private TodoService todoService = new TodoService(); + private final LoginService userValidationService = new LoginService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -138,7 +143,7 @@ import java.util.ArrayList; import java.util.List; public class TodoService { - private static List todos = new ArrayList(); + private static final List todos = new ArrayList(); static { todos.add(new Todo("Learn Web Application")); diff --git a/Step09.md b/Step09.md index 859266f..b8f7974 100644 --- a/Step09.md +++ b/Step09.md @@ -12,7 +12,7 @@ pom.xml javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ pom.xml org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -75,8 +80,8 @@ import in28minutes.todo.TodoService; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private LoginService service = new LoginService(); - private TodoService todoService = new TodoService(); + private final LoginService userValidationService = new LoginService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -139,7 +144,7 @@ import java.util.ArrayList; import java.util.List; public class TodoService { - private static List todos = new ArrayList(); + private static final List todos = new ArrayList(); static { todos.add(new Todo("Learn Web Application")); diff --git a/Step10.md b/Step10.md index f573a22..0557ba0 100644 --- a/Step10.md +++ b/Step10.md @@ -12,7 +12,7 @@ pom.xml javax javaee-web-api - 6.0 + 8.0.1 provided @@ -23,17 +23,22 @@ pom.xml org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -73,7 +78,7 @@ import javax.servlet.http.HttpServletResponse; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private LoginService service = new LoginService(); + private final LoginService service = new LoginService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -134,7 +139,7 @@ import java.util.ArrayList; import java.util.List; public class TodoService { - private static List todos = new ArrayList(); + private static final List todos = new ArrayList(); static { todos.add(new Todo("Learn Web Application")); @@ -163,7 +168,7 @@ import javax.servlet.http.HttpServletResponse; public class TodoServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private TodoService todoService = new TodoService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) diff --git a/Step11.md b/Step11.md index cbb38fd..c0dd237 100644 --- a/Step11.md +++ b/Step11.md @@ -12,15 +12,14 @@ pom.xml javax javaee-web-api - 6.0 + 8.0.1 provided javax.servlet jstl 1.2 - - + @@ -29,17 +28,22 @@ pom.xml org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -79,7 +83,7 @@ import javax.servlet.http.HttpServletResponse; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private LoginService service = new LoginService(); + private final LoginService service = new LoginService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -140,7 +144,7 @@ import java.util.ArrayList; import java.util.List; public class TodoService { - private static List todos = new ArrayList(); + private static final List todos = new ArrayList(); static { todos.add(new Todo("Learn Web Application")); @@ -169,7 +173,7 @@ import javax.servlet.http.HttpServletResponse; public class TodoServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private TodoService todoService = new TodoService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) diff --git a/Step13.md b/Step13.md index 8c15a34..bcb7c00 100644 --- a/Step13.md +++ b/Step13.md @@ -12,15 +12,14 @@ pom.xml javax javaee-web-api - 6.0 + 8.0.1 provided javax.servlet jstl 1.2 - - + @@ -29,17 +28,22 @@ pom.xml org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -79,7 +83,7 @@ import javax.servlet.http.HttpServletResponse; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private LoginService service = new LoginService(); + private final LoginService service = new LoginService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -140,7 +144,7 @@ import java.util.ArrayList; import java.util.List; public class TodoService { - private static List todos = new ArrayList(); + private static final List todos = new ArrayList(); static { todos.add(new Todo("Learn Web Application")); @@ -173,7 +177,7 @@ import javax.servlet.http.HttpServletResponse; public class TodoServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private TodoService todoService = new TodoService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) diff --git a/Step14.md b/Step14.md index f1c4732..ee5b1e5 100644 --- a/Step14.md +++ b/Step14.md @@ -12,7 +12,7 @@ pom.xml javax javaee-web-api - 6.0 + 8.0.1 provided @@ -29,17 +29,22 @@ pom.xml org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -79,7 +84,7 @@ import javax.servlet.http.HttpServletResponse; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private LoginService service = new LoginService(); + private final LoginService service = new LoginService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -122,7 +127,7 @@ import javax.servlet.http.HttpServletResponse; public class DeleteTodoServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private TodoService todoService = new TodoService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -148,7 +153,7 @@ import javax.servlet.http.HttpServletResponse; public class ListTodoServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private TodoService todoService = new TodoService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -207,20 +212,17 @@ public class Todo { } @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Todo other = (Todo) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Todo other = (Todo) obj; + if (name == null) { + return other.name == null; + } else return name.equals(other.name); } } @@ -233,7 +235,7 @@ import java.util.ArrayList; import java.util.List; public class TodoService { - private static List todos = new ArrayList(); + private static final List todos = new ArrayList(); static { todos.add(new Todo("Learn Web Application")); diff --git a/Step15.md b/Step15.md index 5b4c64b..480061c 100644 --- a/Step15.md +++ b/Step15.md @@ -12,7 +12,7 @@ pom.xml javax javaee-web-api - 6.0 + 8.0.1 provided @@ -25,12 +25,12 @@ pom.xml org.webjars bootstrap - 3.3.6 + 5.1.3 org.webjars jquery - 1.9.1 + 3.6.0 @@ -41,17 +41,22 @@ pom.xml org.apache.maven.plugins maven-compiler-plugin - 3.2 + 3.8.1 true - 1.7 - 1.7 + 17 + 17 true + org.apache.maven.plugins + maven-war-plugin + 3.3.1 + + org.apache.tomcat.maven - tomcat7-maven-plugin + tomcat8-maven-plugin 2.2 / @@ -91,7 +96,7 @@ import javax.servlet.http.HttpServletResponse; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private LoginService service = new LoginService(); + private final LoginService service = new LoginService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -134,7 +139,7 @@ import javax.servlet.http.HttpServletResponse; public class DeleteTodoServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private TodoService todoService = new TodoService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -160,7 +165,7 @@ import javax.servlet.http.HttpServletResponse; public class ListTodoServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private TodoService todoService = new TodoService(); + private final TodoService todoService = new TodoService(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) @@ -219,20 +224,17 @@ public class Todo { } @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Todo other = (Todo) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Todo other = (Todo) obj; + if (name == null) { + return other.name == null; + } else return name.equals(other.name); } } @@ -245,7 +247,7 @@ import java.util.ArrayList; import java.util.List; public class TodoService { - private static List todos = new ArrayList(); + private static final List todos = new ArrayList(); static { todos.add(new Todo("Learn Web Application")); diff --git a/Step17.md b/Step17.md index e0a9ffd..a8a28b6 100644 --- a/Step17.md +++ b/Step17.md @@ -5,8 +5,7 @@ Bootstrap Sample Page Todos - +