Package org.springframework.data.mongodb.core.index

Examples of org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator


    // We always have a mapping context in the converter, whether it's a simple one or not
    mappingContext = this.mongoConverter.getMappingContext();
    // We create indexes based on mapping events
    if (null != mappingContext && mappingContext instanceof MongoMappingContext) {
      indexCreator = new MongoPersistentEntityIndexCreator((MongoMappingContext) mappingContext, mongoDbFactory);
      eventPublisher = new MongoMappingEventPublisher(indexCreator);
      if (mappingContext instanceof ApplicationEventPublisherAware) {
        ((ApplicationEventPublisherAware) mappingContext).setApplicationEventPublisher(eventPublisher);
      }
    }
View Full Code Here


  private void prepareIndexCreator(ApplicationContext context) {

    String[] indexCreators = context.getBeanNamesForType(MongoPersistentEntityIndexCreator.class);

    for (String creator : indexCreators) {
      MongoPersistentEntityIndexCreator creatorBean = context.getBean(creator, MongoPersistentEntityIndexCreator.class);
      if (creatorBean.isIndexCreatorFor(mappingContext)) {
        return;
      }
    }

    if (context instanceof ConfigurableApplicationContext) {
View Full Code Here

  @Test
  public void registersDefaultEntityIndexCreatorIfApplicationContextHasOneForDifferentMappingContext() {

    GenericApplicationContext applicationContext = new GenericApplicationContext();
    applicationContext.getBeanFactory().registerSingleton("foo",
        new MongoPersistentEntityIndexCreator(new MongoMappingContext(), factory));
    applicationContext.refresh();

    GenericApplicationContext spy = spy(applicationContext);

    MongoTemplate mongoTemplate = new MongoTemplate(factory, converter);
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.