Reputation: 786
I am trying to integrate a project with Spring + MongoDB + Mongolab + JSF, I found many tutorials, but i didnt find how to configure a remote monogodb database (such as MongoLab) in the Spring Configuration XML file:
<mongo:mongo host="127.0.0.1" port="27017" />
<mongo:db-factory dbname="yourdb" />
Where can I put the login credentials? Please help
Upvotes: 1
Views: 809
Reputation: 786
Here is the working bloc of code
<mongo:mongo id="mongo" host="domainName" port="portNumber" />
<mongo:db-factory id="mongoDbFactory"
host="domainName"
port="portNumber"
username="userName"
password="passWord"
dbname="DBName"
mongo-ref="mongo" />
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>
I tried it and it is working 100%
Thank you for your help
Upvotes: 1