title: How to override the defaults provided by SPRING BOOT Autoconfiguration
body: <p>I have some knowledge of Spring 2.5 development and java but I'm trying to learn more about modern spring including Boot and Data. I'm looking at the project: </p>
  
  <p><a href="https://github.com/spring-projects/spring-data-examples/tree/master/rest/multi-store" rel="nofollow">https://github.com/spring-projects/spring-data-examples/tree/master/rest/multi-store</a> </p>
  
  <p>I have this example working on my machine but I'd like to override some aspects of the example. For instance I'd like to specify my own mongo database server and name to use in the project. It would appear that the thing to do is create a new bean specifying the mongo datasource, but I'm not sure how to do it in this case.</p>
  
  <pre><code>import com.mongodb.Mongo;
  import com.mongodb.MongoClient;
  import example.person.Person;
  import example.person.PersonRepository;
  import example.treasure.Treasure;
  import example.treasure.TreasureRepository;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.boot.context.properties.ConfigurationProperties;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
  
  import javax.activation.DataSource;
  import javax.annotation.PostConstruct;
  import java.net.UnknownHostException;
  
  /**
   * Application configuration file. Used for bootstrap and data setup.
   *
   * @author Greg Turnquist
   * @author Oliver Gierke
   */
  @Configuration
  @EnableAutoConfiguration
  @EnableJpaRepositories
  @EnableMongoRepositories
  public class Application {
  
      private static final Logger log = LoggerFactory.getLogger(Application.class);
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      @Autowired PersonRepository personRepository;
      @Autowired TreasureRepository treasureRepository;
  
      @PostConstruct
      void checkitOut() {
  
          personRepository.save(new Person("Frodo", "Baggins"));
          personRepository.save(new Person("Bilbo", "Baggins"));
  
          for (Person person : personRepository.findAll()) {
              log.info("Hello " + person.toString());
          }
  
          treasureRepository.deleteAll();
          treasureRepository.save(new Treasure("Sting", "Made by the Elves"));
          treasureRepository.save(new Treasure("Sauron's ring", "One ring to rule them all"));
  
          for (Treasure treasure : treasureRepository.findAll()) {
              log.info("Found treasure " + treasure.toString());
          }
      }
  }
  </code></pre>