[JAVA-30997] upgrade spring-boot-mvc to boot 3 (#16190)

* [JAVA-30997] upgrade spring-boot-mvc to boot 3

* [JAVA-30997] upgrade spring-boot-mvc to boot 3
This commit is contained in:
vunamtien 2024-03-26 05:20:02 +07:00 committed by GitHub
parent 452cdc58c9
commit 76c1a02aa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 56 additions and 63 deletions

View File

@ -56,7 +56,7 @@
<module>spring-boot-process-automation</module> <module>spring-boot-process-automation</module>
<module>spring-boot-logging-logback</module> <module>spring-boot-logging-logback</module>
<module>spring-boot-logging-log4j2</module> <module>spring-boot-logging-log4j2</module>
<!-- <module>spring-boot-mvc</module>--> <!-- failing after upgrading to spring boot 3.2.x --> <module>spring-boot-mvc</module>
<module>spring-boot-mvc-2</module> <module>spring-boot-mvc-2</module>
<module>spring-boot-mvc-3</module> <module>spring-boot-mvc-3</module>
<module>spring-boot-mvc-4</module> <module>spring-boot-mvc-4</module>

View File

@ -52,8 +52,8 @@
<!--JSF --> <!--JSF -->
<dependency> <dependency>
<groupId>org.glassfish</groupId> <groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId> <artifactId>jakarta.faces</artifactId>
<version>${javax.faces.version}</version> <version>${jakarta.faces.version}</version>
</dependency> </dependency>
<!--Test --> <!--Test -->
<dependency> <dependency>
@ -73,8 +73,9 @@
<artifactId>hibernate-validator</artifactId> <artifactId>hibernate-validator</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.validation</groupId> <groupId>jakarta.validation</groupId>
<artifactId>validation-api</artifactId> <artifactId>jakarta.validation-api</artifactId>
<version>${jakarta.validation-api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -112,8 +113,9 @@
<properties> <properties>
<!-- ROME for RSS --> <!-- ROME for RSS -->
<rome.version>1.10.0</rome.version> <rome.version>1.10.0</rome.version>
<javax.faces.version>2.3.7</javax.faces.version> <jakarta.faces.version>4.1.0-M1</jakarta.faces.version>
<aspectj.version>1.9.20.1</aspectj.version> <aspectj.version>1.9.20.1</aspectj.version>
<jakarta.validation-api.version>3.1.0-M1</jakarta.validation-api.version>
<start-class>com.baeldung.springbootmvc.SpringBootMvcApplication</start-class> <start-class>com.baeldung.springbootmvc.SpringBootMvcApplication</start-class>
</properties> </properties>

View File

@ -1,8 +1,8 @@
package com.baeldung.annotation.servletcomponentscan.components; package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.ServletContextEvent; import jakarta.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import jakarta.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener; import jakarta.servlet.annotation.WebListener;
@WebListener @WebListener
public class AttrListener implements ServletContextListener { public class AttrListener implements ServletContextListener {

View File

@ -1,9 +1,10 @@
package com.baeldung.annotation.servletcomponentscan.components; package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.annotation.WebServlet; import jakarta.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;

View File

@ -1,8 +1,9 @@
package com.baeldung.annotation.servletcomponentscan.components; package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.*; import jakarta.servlet.*;
import javax.servlet.annotation.WebFilter; import jakarta.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam; import jakarta.servlet.annotation.WebInitParam;
import java.io.IOException; import java.io.IOException;
@WebFilter(urlPatterns = "/hello", description = "a filter for hello servlet", initParams = { @WebInitParam(name = "msg", value = "filtering ") }, filterName = "hello filter", servletNames = { "echo servlet" }) @WebFilter(urlPatterns = "/hello", description = "a filter for hello servlet", initParams = { @WebInitParam(name = "msg", value = "filtering ") }, filterName = "hello filter", servletNames = { "echo servlet" })

View File

@ -1,11 +1,12 @@
package com.baeldung.annotation.servletcomponentscan.components; package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.ServletConfig; import jakarta.servlet.ServletConfig;
import javax.servlet.annotation.WebInitParam; import jakarta.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet; import jakarta.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@WebServlet(urlPatterns = "/hello", initParams = { @WebInitParam(name = "msg", value = "hello") }) @WebServlet(urlPatterns = "/hello", initParams = { @WebInitParam(name = "msg", value = "hello") })

View File

@ -1,7 +1,7 @@
package com.baeldung.internationalization; package com.baeldung.internationalization;
import javax.annotation.security.RolesAllowed;
import jakarta.annotation.security.RolesAllowed;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -3,8 +3,7 @@ package com.baeldung.responseentity;
import java.io.IOException; import java.io.IOException;
import java.time.Year; import java.time.Year;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;

View File

@ -1,7 +1,6 @@
package com.baeldung.restvalidation.config; package com.baeldung.restvalidation.config;
import javax.validation.MessageInterpolator; import jakarta.validation.MessageInterpolator;
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -4,8 +4,7 @@ import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.validation.MessageInterpolator; import jakarta.validation.MessageInterpolator;
import org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator; import org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator;
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;

View File

@ -1,7 +1,6 @@
package com.baeldung.restvalidation.service1; package com.baeldung.restvalidation.service1;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import lombok.*; import lombok.*;
@Data @Data

View File

@ -1,5 +1,6 @@
package com.baeldung.restvalidation.service1; package com.baeldung.restvalidation.service1;
import jakarta.validation.Valid;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -7,8 +8,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Valid;
import com.baeldung.restvalidation.response.InputFieldError; import com.baeldung.restvalidation.response.InputFieldError;
import com.baeldung.restvalidation.response.UpdateUserResponse; import com.baeldung.restvalidation.response.UpdateUserResponse;

View File

@ -1,7 +1,6 @@
package com.baeldung.restvalidation.service2; package com.baeldung.restvalidation.service2;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import lombok.*; import lombok.*;
@Data @Data

View File

@ -3,8 +3,7 @@ package com.baeldung.restvalidation.service2;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Valid; import jakarta.validation.Valid;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;

View File

@ -1,5 +1,8 @@
package com.baeldung.restvalidation.service3; package com.baeldung.restvalidation.service3;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.FIELD;
@ -12,8 +15,6 @@ import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@Documented @Documented
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })

View File

@ -1,7 +1,7 @@
package com.baeldung.restvalidation.service3; package com.baeldung.restvalidation.service3;
import javax.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;
public class FieldNotEmptyValidator implements ConstraintValidator<FieldNotEmpty, Object> { public class FieldNotEmptyValidator implements ConstraintValidator<FieldNotEmpty, Object> {

View File

@ -3,8 +3,7 @@ package com.baeldung.restvalidation.service3;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Valid; import jakarta.validation.Valid;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;

View File

@ -6,9 +6,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.view.feed.AbstractRssFeedView; import org.springframework.web.servlet.view.feed.AbstractRssFeedView;

View File

@ -3,9 +3,9 @@ package com.baeldung.springbootannotations;
import java.util.Arrays; import java.util.Arrays;
import java.util.Properties; import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
import jakarta.persistence.EntityManagerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder; import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionMessage;

View File

@ -1,7 +1,6 @@
package com.baeldung.springbootmvc; package com.baeldung.springbootmvc;
import javax.validation.Valid; import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;

View File

@ -1,7 +1,6 @@
package com.baeldung.springbootmvc.jsfapplication; package com.baeldung.springbootmvc.jsfapplication;
import javax.faces.webapp.FacesServlet; import jakarta.faces.webapp.FacesServlet;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean;

View File

@ -1,8 +1,8 @@
package com.baeldung.springbootmvc.model; package com.baeldung.springbootmvc.model;
import javax.validation.constraints.Email; import jakarta.validation.constraints.Email;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
public class LoginForm { public class LoginForm {

View File

@ -1 +1 @@
javax.validation.constraints.NotEmpty.message=The field cannot be empty jakarta.validation.constraints.NotEmpty.message=The field cannot be empty

View File

@ -1 +1 @@
javax.validation.constraints.NotEmpty.message=本欄不能留空 jakarta.validation.constraints.NotEmpty.message=本欄不能留空

View File

@ -7,7 +7,7 @@
<servlet> <servlet>
<servlet-name>Faces Servlet</servlet-name> <servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>

View File

@ -4,9 +4,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import javax.servlet.FilterRegistration; import jakarta.servlet.FilterRegistration;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -4,9 +4,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import javax.servlet.FilterRegistration; import jakarta.servlet.FilterRegistration;
import javax.servlet.ServletContext; import jakarta.servlet.ServletContext;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;