cant config correct mongo db name in spring
<p>Im currently diving in MongoDB and Spring.
Although another db is configured, it still tries to create/read from the wrong db.</p>

<p>Here's my code:</p>

<pre><code>@Configuration
@EnableMongoRepositories
public class MongoConfig {

  @Bean
  public MongoClientFactoryBean mongo() {
    MongoClientFactoryBean mongo = new MongoClientFactoryBean();
    mongo.setHost("localhost");
    return mongo;
  }

  @Bean
  public MongoOperations mongoTemplate(Mongo mongo) {
      return new MongoTemplate(mongo, "gabble");
  }
}
</code></pre>

<p>Handler:</p>

<pre><code>@Component
public class SomeHandler {
  private static final Logger log = Logger.getLogger(SomeHandler.class);
  private MongoOperations mongo;


  @Autowired
  public SomeHandler(MongoOperations mongo) {
      this.mongo = mongo;
  }

  public void registerNewUser(User user, Credential credential) {       
    log.info(mongo.getCollectionNames());

    mongo.save(user,"user");
    mongo.save(credential,"credential");

    log.info("count: "+mongo.getCollection("user").count());
    log.info("content: "+mongo.getCollection("user").find());
    log.info("stored new user in database");
  }
}
</code></pre>

<p>the output of log.info():</p>

<pre><code>2016-08-03 14:46:13 INFO  SomeHandler:29 - count: 1
2016-08-03 14:46:13 INFO  SomeHandler:30 - content: Cursor id=0, ns=test.user, query={ }, numIterated=0, readPreference=primary
</code></pre>

<p>As you can see, mongo object refers to test.user, but why ? 
Is there more configuration needed ? The db test gets also created by spring. </p>