DATADOC-189 - Improved extensibility of MongoRepositoryFactoryBean.

Creation of MongoRepositoryFactory is now delegated into a template method that gets a MongoTemplate handed over.
This commit is contained in:
Oliver Gierke
2011-07-07 10:46:54 +02:00
parent 2d09b8b7d1
commit df24218a4f

View File

@@ -79,12 +79,22 @@ public class MongoRepositoryFactoryBean<T extends Repository<S, ID>, S, ID exten
* #createRepositoryFactory()
*/
@Override
protected RepositoryFactorySupport createRepositoryFactory() {
protected final RepositoryFactorySupport createRepositoryFactory() {
MongoRepositoryFactory factory = new MongoRepositoryFactory(template);
RepositoryFactorySupport factory = getFactoryInstance(template);
factory.addQueryCreationListener(new IndexEnsuringQueryCreationListener(template));
return factory;
}
/**
* Creates and initializes a {@link RepositoryFactorySupport} instance.
*
* @param template
* @return
*/
protected RepositoryFactorySupport getFactoryInstance(MongoTemplate template) {
return new MongoRepositoryFactory(template);
}
/*
* (non-Javadoc)