spring - mongo java driver 2.14.0. Change Deprecated code -


i upgrading mongo java driver jar 2.14.0. old code working fine following code showing deprecated classes , constructor need compatible code without deprecated classes , constructor mongo-java-driver.jar 2.14.0.

public mongotemplate getmongotemplate() {      simplemongodbfactory simplemongodbfactory = null;      try {          mongooptions opts = new mongooptions();//depricate          opts.threadsallowedtoblockforconnectionmultiplier = getthreadsallowedtoblockforconnectionmultiplier();//depricate          opts.connectionsperhost = getconnectionsperhost();//depricate          serveraddress addr = new serveraddress(gethost(), getport());          mongo mongo = new mongo(addr, opts);//depricate          simplemongodbfactory = new simplemongodbfactory(mongo,                 getdatabasename());//depricate          if (mongotemplate == null) {              mongotemplate = new mongotemplate(simplemongodbfactory);          }      } catch (unknownhostexception e) {          logger.error(e.getmessage());      } catch (mongoexception e) {          logger.error(e.getmessage());      }      return mongotemplate; } 

this not spring data mongodb code. code mongodb java driver has beed deprecated quite while ago already. users incentivized use mongoclient on mongo, mongoclientoptions on mongooptions etc.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -