There is a service which uses SpringBoot 2.2
and previously it uses javax
default validations. However due to some other newly added dependency, jakarta
validation had to be added as well. Now, existing javax
validations are not working due to name space conflict issues. Following things were tried for using Jakarta instead of Javax and none worked.
javax
valdation by excluding spring boot validation from spring boot webSpringBoot 2.3
Some articles say that Jakarta validation is supported only for SpringBoot 3.x
versions - Having such an upgrade from 2.2 to 3.x is not possible right now.
And some other articles say that the Jakarta validation should work SpringBoot 2.3+
What is the most effective solution for this?
This quite a hard problem to solve, there are a few options that you can look into.
Even though option 3 is the most unsatisfying answer I would still recommend you to move as soon as possible to at least a supported version. See https://spring.io/projects/spring-boot#support for which versions are supported. As you can see on the spring boot versions page your service is already 4 years out of support which is a enormous security risk on it's own.
To help you with your upgrade journey I would like to point you towards Openrewrite which is a tool that helps you migrate your application. This tool has both recipes for upgrading to java 17 as for upgrading from spring boot 2.7 to 3.0 and beyond.