title: Spring Data : Java configuration for MongoDB without XML
body: <p>I tried the <a href="http://spring.io/guides/gs/accessing-data-mongodb/" rel="noreferrer">Spring Guide Accessing Data with MongoDB</a>. What I can't figure out is how do I configure my code to not use the default server address and not use the default database. I have seen many ways to do it with XML but I am trying to stay with fully XML-less configurations.</p>
  
  <p>Does anyone have an example that sets the server and database without XML and can be easily integrated into the sample they show in the Spring Guide?</p>
  
  <p>Note: I did find how to set the collection (search for the phrase "Which collection will my documents be saved into " <a href="http://docs.spring.io/spring-data/data-mongodb/docs/1.4.2.RELEASE/reference/htmlsingle/" rel="noreferrer">on this page</a>.</p>
  
  <p>Thank you!</p>
  
  <p>p.s. same story with the Spring Guide for JPA -- how do you configure the db properties -- but that is another post :)</p>