Tente isto:
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;
}
Atualizado
Na verdade o método:
@Bean
@ConditionalOnMissingBean
public GridFsTemplate gridFsTemplate(MongoDbFactory mongoDbFactory,
MongoTemplate mongoTemplate) {
return new GridFsTemplate(
new GridFsMongoDbFactory(mongoDbFactory, this.properties),
mongoTemplate.getConverter());
}
em
MongoDataAutoConfiguration
requer um bean do MongoTemplate de nome "mongoTemplate", que não pode ser encontrado, em vez disso você definiu seus próprios 2 outros beans "sourceTemplate" e "destinationTemplate". Acho que isso vai resolver seu problema!