title: Spring Boot & Mongo: custom MappingMongoConverter doesn't work during DotReplacement
body: <p>I need to achive dotReplacementKey</p>
  
  <p>I'm using MongoDB with such config:</p>
  
  <pre><code>@Configuration
  public class MongoTemplateConfig {
  
  @Value("${adserver_mongo_connection_string}")
  private String databaseConnectionString;
  
  @Bean
  public MongoDbFactory mongoDbFactory() throws UnknownHostException {
  
      MongoClientURI uri = new MongoClientURI(databaseConnectionString.trim());
      return new SimpleMongoDbFactory(uri);
  }
  
  @Bean
  public MongoTemplate mongoTemplate() throws UnknownHostException {
      return new MongoTemplate(mongoDbFactory());
  }
  
  @Bean
  public MappingMongoConverter mongoConverter(MongoDbFactory mongoFactory, MongoMappingContext mongoMappingContext) throws Exception {
      DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoFactory);
      MappingMongoConverter mongoConverter = new MappingMongoConverter(dbRefResolver, mongoMappingContext);
      mongoConverter.setMapKeyDotReplacement(".");
  
      return mongoConverter;
  }
  }
  </code></pre>
  
  <p>I'm doing upsert as follows:
  <code>mongoTemplate.bulkOps(...).upsert(...)</code></p>
  
  <p>but during runtime via debug I found out that <strong>different MappingMongoConverter is used</strong> rather then this that was configured as a @Bean</p>
  
  <p>btw, if @Inject wherever MappingMongoConverter I get proper bean from config with keyDotReplacement="."
  but looks like Spring Boot uses another one under the hood</p>
  
  <p>P.S. I have seen this <a href="https://stackoverflow.com/questions/44804985/mappingmongoconverter-setmapkeydotreplacement-dont-work">question</a> without correct answer, but tried with <code>mongoConverter.afterPropertiesSet()</code> and obviously it doesn't work as well</p>