Example usage for org.springframework.data.mongodb.core.convert MongoConverter getConversionService

List of usage examples for org.springframework.data.mongodb.core.convert MongoConverter getConversionService

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.convert MongoConverter getConversionService.

Prototype

ConversionService getConversionService();

Source Link

Document

Returns the underlying ConversionService used by the converter.

Usage

From source file:com.sangupta.jerry.mongodb.MongoTemplateBasicOperations.java

/**
 * Get the basic services from mongo template
 *//*  w ww . j  av a  2  s . c om*/
private synchronized void fetchMappingContextAndConversionService() {
    if (mappingContext == null) {
        MongoConverter mongoConverter = this.mongoTemplate.getConverter();
        mappingContext = mongoConverter.getMappingContext();
        conversionService = mongoConverter.getConversionService();

        MongoPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(entityClass);
        MongoPersistentProperty idProperty = persistentEntity.getIdProperty();
        this.idKey = idProperty == null ? "_id" : idProperty.getName();
    }
}