Mongo java driver upgrade from 3.12.1 to 4.2.3

Hii currently I am having mongo-java-driver 3.12.1 , spring-data-mongodb 2.2.5.RELEASE configured, Spring boot version 2.2.5.RELEASE

I tried upgrade spring boot to 2.5.8 with spring-data-mongodb 3.2.3 and mongodb-java-driver-core mongodb-java-driver-sync 4.2.3

But getting various errors of class not found/ method not found on deployment what is right way to upgrade mongo java driver and spring data mongodb with proper dependencies.

I’m currently migrating from spring2.3.6 to spring2.5.8 for mongo-java-driver upgradation. During this process of changing the spring version and building the application via gradle and starting the app, various errors were faced due to deprecation, dependency path change, adding dependencies on applying those kinds of changes we were able to run the application. Hope this process we followed may help.