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

Lists in Python -

android - can not access to progress bar in an other activity -

html - Not able to access next element of an array javascript -