Review
In the previous section, we have installed and configured our servers for MongoDB replication. In this section, we will update our Spring application to support MongoDB Replica Sets.Table of Contents
Part 1: IntroductionPart 2: Installation and configuration of Replica Sets
Part 3: Spring app configuration
Part 4: Testing the servers
Spring App Configuration
We have setup a MongoDB Replica Set using four servers, and we've examined the output from the logs and verified that all instances are running. Our next step is to configure our Spring MongoDB-base application.Since we're reusing our application from the tutorial Spring MVC 3.1 - Implement CRUD with Spring Data MongoDB, adding a MongoDB Replica Set support in Spring is trivial. All we need to do is modify the spring.properties file with the following contents (this file is located under the WEB-INF directory):
Then we have to modify as well the spring-data.xml file with the following updates:
That's all we need to for our Spring application!
0 komentar:
Post a Comment