use of org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean in project spring-data-mongodb by spring-projects.
the class PerformanceTests method setUp.
@Before
public void setUp() throws Exception {
this.mongo = new MongoClient();
SimpleMongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(this.mongo, DATABASE_NAME);
MongoMappingContext context = new MongoMappingContext();
context.setInitialEntitySet(Collections.singleton(Person.class));
context.afterPropertiesSet();
this.converter = new MappingMongoConverter(new DefaultDbRefResolver(mongoDbFactory), context);
this.operations = new MongoTemplate(new SimpleMongoDbFactory(this.mongo, DATABASE_NAME), converter);
MongoRepositoryFactoryBean<PersonRepository, Person, ObjectId> factory = new MongoRepositoryFactoryBean<PersonRepository, Person, ObjectId>(PersonRepository.class);
factory.setMongoOperations(operations);
factory.afterPropertiesSet();
this.repository = factory.getObject();
}
Aggregations