Prova questo:
public class MongoDbConfig {
@Bean(name = {"sourceTemplate", "mongoTemplate"})
public MongoTemplate getSourceTemplate() {
MongoTemplate mt = new MongoTemplate(getMongoDbFactory(sourceServers, sourceDatabaseName));
return mt;
}
@Bean(name="destinationTemplate")
public MongoTemplate getDestinationTemplate() {
MongoTemplate mt = new MongoTemplate(getMongoDbFactory(destinationServers, destinationDatabaseName));
return mt;
}
}
public class SourceDaoImpl implements SourceDao {
@Autowired
@Qualifier("sourceTemplate")
private MongoOperations mongoOps;
}
public class DestinationDaoImpl implements DestinationDao {
@Autowired
@Qualifier("destinationTemplate")
private MongoOperations mongoOps;
}
Aggiornato
In realtà il metodo:
@Bean
@ConditionalOnMissingBean
public GridFsTemplate gridFsTemplate(MongoDbFactory mongoDbFactory,
MongoTemplate mongoTemplate) {
return new GridFsTemplate(
new GridFsMongoDbFactory(mongoDbFactory, this.properties),
mongoTemplate.getConverter());
}
in MongoDataAutoConfiguration
richiede un bean di MongoTemplate di nome "mongoTemplate", che non può essere trovato, invece hai definito i tuoi altri 2 bean "sourceTemplate" e "destinationTemplate".
Penso che questo risolverà il tuo problema!