Опитайте това:
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;
}
Актуализирано
Всъщност методът:
@Bean
@ConditionalOnMissingBean
public GridFsTemplate gridFsTemplate(MongoDbFactory mongoDbFactory,
MongoTemplate mongoTemplate) {
return new GridFsTemplate(
new GridFsMongoDbFactory(mongoDbFactory, this.properties),
mongoTemplate.getConverter());
}
в MongoDataAutoConfiguration
изисква bean на MongoTemplate с име "mongoTemplate", който не може да бъде намерен, вместо това сте дефинирали свои собствени 2 bean-а "sourceTemplate" и "destinationTemplate".
Мисля, че това ще разреши проблема ви!