title: Auditing with spring-data-mongodb
body: <p>I am trying to enable auto audit fields with spring data mongodb as explained <a href="http://www.javabydefault.com/2014/03/how-to-set-createdby-createddate.html" rel="noreferrer">here</a>. Below is my configuration class</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = "com.abc")
  @EnableMongoRepositories(basePackages = "com.abc.xyz.repository")
  @EnableMongoAuditing
  public class ApplicationConfiguration {
  
      @Bean
      public MongoDbFactory mongoDbFactory() throws Exception {
          ServerAddress serverAddress = new ServerAddress("127.0.0.1", 27017);
          MongoCredential mongoCredential = MongoCredential.createCredential("user", "test", "abc123".toCharArray());
          MongoClient mongoClient = new MongoClient(serverAddress, Arrays.asList(mongoCredential));
          return new SimpleMongoDbFactory(mongoClient, "test");
      }
  
      @Bean
      public MongoTemplate mongoTemplate() throws Exception {
          return new MongoTemplate(mongoDbFactory());
      }
  }
  </code></pre>
  
  <p>But when I add @EnableMongoAuditing, I am getting the below error on starting the server. </p>
  
  <pre><code>Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoAuditingHandler': Cannot create inner bean '(inner bean)#6dca0c34' of type [org.springframework.data.mongodb.config.MongoAuditingRegistrar$MongoMappingContextLookup] while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#6dca0c34': Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type [org.springframework.data.mongodb.core.convert.MappingMongoConverter] found for dependency [org.springframework.data.mongodb.core.convert.MappingMongoConverter]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.data.mongodb.core.convert.MappingMongoConverter] found for dependency [org.springframework.data.mongodb.core.convert.MappingMongoConverter]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
      at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:236)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
  </code></pre>