Reputation: 2799
I am tying to migrate hard coded database dependencies into the spring framework
so
Mongo m = new Mongo("192.168.0.0.1");
DB db = m.getDB("db name");
db.authenticate("user", "pass".toCharArray());
would become:
<mongo:mongo host="192.168.0.0.1" port="27017" />
<bean id="mongoDatabase"
factory-bean="mongo"
factory-method="getDB">
<constructor-arg value="db name" />
</bean>
But I am not sure how to call authenticate. It would be nice to know the best way to do this generally.
(Usernames and passwords have been changed to protect the innocent)
Upvotes: 0
Views: 182