Upgrade of tomcat from 9.0.64 to 10.0.22 - spring

what come in place of MockHttpServletResponse in servlet 5? This class is not supporting in servlet 5, what is alternative?

Spring 5 is not compatible with Tomcat 10 due to the package renaming from javax to jakarta. The Spring that will work with jakarta package names will be Spring 6.
https://github.com/spring-projects/spring-boot/issues/25276
"This is to be expected. Tomcat 10 is an implementation of the Servlet 5 specification (part of Jakarta EE 9) that renamed all of the packages from javax.servlet to jakarta.servlet. Neither Spring Boot nor Spring Framework supports Jakarta EE 9 at this time. Support is planned, hopefully for Spring Framework 6 and Spring Boot 3, assuming the rest of the ecosystem is ready."
The alternative is to stay on Tomcat 9 until Spring 6 is out.

Related

What are the Spring Native changes from Spring Boot 2 (incubation) to Spring Boot 3?

As stated in docs: "After 3+ years of incubation in the Spring Native experimental project with Spring Boot 2, native support is moving to General Availability with Spring Framework 6 and Spring Boot 3!"
But, what are the actual changes/enhancements of the Spring Native notion that took place in Spring Boot 3, in comparison to the Spring Boot 2?
I have checked documentation, but didn't find anything till now

Spring boot 3 and Spring 6 with Tomcat 9

I have not found the answer I want on the web so I've decided to ask it here. Apologize if this breaks any rules, etc.
We're trying to upgrade some of our java applications to spring boot 3 and spring 6. The question is, will these apps still work with Tomcat 9?
These apps are currently running spring boot 2, spring 5 and Tomcat 9.
Based on this, Tomcat 9 won't work with Spring 6. So, moving to spring 6 will requrire going to Tomcat 10.
https://devm.io/spring/spring-framework-6-release
The sixth major version of the Spring Framework has been released,
with Spring Boot 3.0 to follow at the end of November. Spring
Framework 6.0 requires a minimum of JDK 17 at runtime, as well as a
minimum of Tomcat 10/Jetty 11.

Is Spring 5 compatible with Hibernate 6.1?

The Problem
We currently have a Spring MVC application (non-spring-boot) based on Spring 5 and Hibernate 5. We have to migrate the app to Hibernate 6.1.
During testing we are encountering exceptions once upgraded to Hibernate 6.1. The root cause exception
java.lang.NoClassDefFoundError:
Could not initialize class org.springframework.orm.hibernate5.LocalSessionFactoryBuilder
Is Spring 5 compatible with Hibernate 6.1? I checked the Spring.io website but could not find any compatibility information for spring-orm.
What I Expected
I expected the application to work with Hibernate 6.1 upgrade.
Environment
Spring MVC 5.3.21 (non-spring-boot)
Hibernate 6.1.0
Tomcat 9.0.64
Java 13
Ubuntu 20
Research Performed
I checked the spring.io website and reference manual. I could not find compatibility information for spring-orm and Hibernate 6.1
How to Reproduce
Deploy a Spring MVC web app (non-spring-boot) that uses Spring 5.3.21 and Hibernate 6.1

what is the spring-web module compatible with tomcat 10

what is the spring-web module version compatible with tomcat 10?
Spring web Application is running on tomcat 9.x and its fail with ClassCastException ad tomcat 10 using jakarta API.
java.lang.ClassCastException: org.springframework.web.filter.DelegatingFilterProxy cannot be cast to jakarta.servlet.Filter
There is none, currently, none of the spring 5 versions support Jakarta packages.
They did say however that in version 6 they will tho, but for now it supports Javax packages.
There might be some workaround, I know I had to test if Spring 4 works with JDK11, it does, but Spring suggests using Spring 5 for JDK11.
For Spring MVC 5, the Spring MVC DispatcherServlet has a dependency on the javax.servlet.* package namespace. This is using the Java EE 8 javax package naming. Since Tomcat 10 is based on Jakarta EE 9, the packages for javax naming are not supported. This explains why Spring MVC 5 does not work on Tomcat 10.
https://github.com/spring-projects/spring-boot/issues/25276

Spring mvc compatibile with Servlet 2.5

I have developed some rest services with Spring mvc 3.0.9. In some case I have an exception. It depends that my spring version use Servlet 3.0 api (my application server is jboss eap 5.1). What is latest spring mvc version compatible with Servlet 2.5? Thanks.
Spring 3.2 should work with Servlet 2.5 API.
Only Spring 4.0 requires Serlvet 3.0:
refer this official documentation for more info.
3 New Features and Enhancements in Spring Framework 4.0)
3.4 Java EE 6 and 7
Java EE version 6 or above is now considered the baseline for Spring
Framework 4, with the JPA 2.0 and Servlet 3.0 specifications being of
particular relevance.
Spring 4.0 work with Servlet 2.5.
See document: (https://docs.spring.io/spring/docs/4.3.14.RELEASE/spring-framework-reference/htmlsingle/)
3.4 Java EE 6 and 7
Java EE version 6 or above is now considered the baseline for Spring
Framework 4, with the JPA 2.0 and Servlet 3.0 specifications being of
particular relevance. In order to remain compatible with Google App
Engine and older application servers, it is possible to deploy a
Spring 4 application into a Servlet 2.5 environment. However, Servlet
3.0+ is strongly recommended and a prerequisite in Spring’s test and mock packages for test setups in development environments.
3.7 General Web Improvements
Deployment to Servlet 2.5 servers remains an option, but Spring
Framework 4.0 is now focused primarily on Servlet 3.0+ environments.
If you are using the Spring MVC Test Framework you will need to ensure
that a Servlet 3.0 compatible JAR is in your test classpath.

Resources