All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.springboot.database.mongodb.main.MongodbDatabaseConfiguration.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package {{packageName}}.wire.mongodb.infrastructure.secondary;

import {{packageName}}.wire.mongodb.infrastructure.secondary.JSR310DateConverters.DateToZonedDateTimeConverter;
import {{packageName}}.wire.mongodb.infrastructure.secondary.JSR310DateConverters.ZonedDateTimeToDateConverter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

@Configuration
@EnableMongoRepositories({ "{{packageName}}" })
@Import(value = MongoAutoConfiguration.class)
class MongodbDatabaseConfiguration {

  @Bean
  public MongoCustomConversions mongoCustomConversions() {
    List> converters = new ArrayList<>();
    converters.add(DateToZonedDateTimeConverter.INSTANCE);
    converters.add(ZonedDateTimeToDateConverter.INSTANCE);
    return new MongoCustomConversions(converters);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy