mongdb connection with auth
below connection needs mongo-java-driver dependency
<bean class="com.mangofactory.swagger.configuration.SpringSwaggerConfig" />
<mongo:db-factory id="mongoDbFactory" client-uri="mongodb://${mongo.username}:${mongo.password}@${mongo.host}:${mongo.port}/${mongo.dbname}" />
<!-- Factory bean that creates the Mongo instance -->
<!-- MongoTemplate for connecting and quering the documents in the database -->
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg ref="mongoDbFactory" />
</bean>