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.