Search in sources :

Example 1 with DateToOffsetDateTimeConverter

use of de.spring.example.persistence.converters.DateToOffsetDateTimeConverter in project JavaForFun by gumartinm.

the class MongoConfiguration method customConversions.

// IT DOES NOT WORK!!!
// I THINK THERE IS A BUG BECAUSE MappingMongoConverter.this.conversionService never includes my custom converters!!!!
@Bean
@Override
public CustomConversions customConversions() {
    List<Converter<?, ?>> converterList = new ArrayList<>();
    converterList.add(new OffsetDateTimeToDateConverter());
    converterList.add(new DateToOffsetDateTimeConverter());
    return new MongoCustomConversions(converterList);
}
Also used : DateToOffsetDateTimeConverter(de.spring.example.persistence.converters.DateToOffsetDateTimeConverter) OffsetDateTimeToDateConverter(de.spring.example.persistence.converters.OffsetDateTimeToDateConverter) MongoCustomConversions(org.springframework.data.mongodb.core.convert.MongoCustomConversions) ArrayList(java.util.ArrayList) OffsetDateTimeToDateConverter(de.spring.example.persistence.converters.OffsetDateTimeToDateConverter) Converter(org.springframework.core.convert.converter.Converter) DateToOffsetDateTimeConverter(de.spring.example.persistence.converters.DateToOffsetDateTimeConverter) Bean(org.springframework.context.annotation.Bean)

Aggregations

DateToOffsetDateTimeConverter (de.spring.example.persistence.converters.DateToOffsetDateTimeConverter)1 OffsetDateTimeToDateConverter (de.spring.example.persistence.converters.OffsetDateTimeToDateConverter)1 ArrayList (java.util.ArrayList)1 Bean (org.springframework.context.annotation.Bean)1 Converter (org.springframework.core.convert.converter.Converter)1 MongoCustomConversions (org.springframework.data.mongodb.core.convert.MongoCustomConversions)1