I am implementing mongodb in java. Whenever my application starts new connection pool for mongoDB is created. Is there any way I can destroy that connection pool and create a new one, without restarting my application. I know that if any argument is change in mongoURI, a connection pool is reinitialized, but I want to know if there is anyway we can do that without making any changes in URI arguments.By main goal is to destroy the connection pool and create new connection pool ! This connection pool is created by MongoClient bean. Therefore I wanted to destroy and recreate the MongoClient Bean.
<bean id="monURI" class="com.mongodb.MongoClientURI">
<constructor-arg name="uri" value="${MONGO_URI}"/>
</bean>
<bean id="mongoC" class="com.mongodb.MongoClient">
<constructor-arg ref="monURI"/>
</bean>