Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Spring Data Mongodb - single configuration for standalone mongo and replicaset

$
0
0

I started out with a single mongo instance as my database, configured in spring xml:

<mongo:mongo host="localhost" port="27017" />

Recently, I changed my configuration to use a 3 node replica set, configured as:

<mongo:mongo replica-set="${my.replica.set}" />

Everything works great.

My current problem is that for my dev environment I'd like to use the single localhost mongo config and for int and prod envrionments I'd like to use the replica set config. The differing values I will handle via properties files. The question is about the mongo config itself.

Something along the lines of the example below would be ideal...

<mongo:mongo uri="localhost:27017" />
<mongo:mongo uri="localhost:27017,localhost:27018" />

I ran into this example: spring-boot uriCanBeCustomized unitTest

Is there a way to do this in spring config?

I am using spring-data-mongodb-1.7.0.RELEASE.


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>