content: package com.konsol.beatstream.config;
  
  import io.mongock.runner.springboot.EnableMongock;
  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.context.annotation.Profile;
  import org.springframework.core.convert.converter.Converter;
  import org.springframework.data.mongodb.config.EnableMongoAuditing;
  import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
  import org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener;
  import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
  import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
  import tech.jhipster.config.JHipsterConstants;
  import tech.jhipster.domain.util.JSR310DateConverters.DateToZonedDateTimeConverter;
  import tech.jhipster.domain.util.JSR310DateConverters.ZonedDateTimeToDateConverter;
  
  @Configuration
  @EnableMongock
  @EnableMongoRepositories("com.konsol.beatstream.repository")
  @Profile("!" + JHipsterConstants.SPRING_PROFILE_CLOUD)
  @Import(value = MongoAutoConfiguration.class)
  @EnableMongoAuditing(auditorAwareRef = "springSecurityAuditorAware")
  public class DatabaseConfiguration {
  
      @Bean
      public ValidatingMongoEventListener validatingMongoEventListener() {
          return new ValidatingMongoEventListener(validator());
      }
  
      @Bean
      public LocalValidatorFactoryBean validator() {
          return new LocalValidatorFactoryBean();
      }
  
      @Bean
      public MongoCustomConversions customConversions() {
          List<Converter<?, ?>> converters = new ArrayList<>();
          converters.add(DateToZonedDateTimeConverter.INSTANCE);
          converters.add(ZonedDateTimeToDateConverter.INSTANCE);
          return new MongoCustomConversions(converters);
      }
  }
  