title: Failed to introspect annotated methods on class org.springframework.data.mongodb.core.SimpleMongoDbFactory
body: <p>I was getting error: <code>Failed to introspect annotated methods on class org.springframework.data.mongodb.core.SimpleMongoDbFactory</code>. Here is the full stacktrace:</p>
  
  <pre><code>05/07/2018 17:16:03.386 [localhost-startStop-48] ERROR
                                  o.s.web.context.ContextLoader.initWebApplicationContext(316) - Context initialization failed
  java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.data.mongodb.core.SimpleMongoDbFactory
          at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:151) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]
          at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:157) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:108) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:278) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) ~[spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
          at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:409) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) [spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003) [catalina.jar:7.0.65]
          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517) [catalina.jar:7.0.65]
  </code></pre>
  
  <p>The contents of ApplicationContext.xml are as follows:</p>
  
  <pre><code>&lt;bean id="mongoConfig"
      class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;
      &lt;property name="location" value="classpath:/config/mongo.properties" /&gt;
  &lt;/bean&gt;
  
  &lt;mongo:db-factory id="dbName" dbname="test" /&gt;
  
  
  &lt;bean id="mongo" class="org.springframework.data.mongodb.core.MongoFactoryBean"&gt;
      &lt;property name="host" value="#{mongoConfig['mongo.host']}" /&gt;
      &lt;property name="port" value="#{mongoConfig['mongo.port']}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"&gt;
      &lt;constructor-arg ref="mongo" /&gt;
      &lt;constructor-arg value="#{mongoConfig['mongo.dbName']}" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Now I am getting following error:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.data.mongodb.core.MongoFactoryBean] for bean with name 'mongo' defined in class path resource [config/META-INF/spring/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.data.mongodb.core.MongoFactoryBean at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1380) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:668) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:635) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1489) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:420) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:208) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1276) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1193) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] ... 49 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.data.mongodb.core.MongoFactoryBean at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854) ~[catalina.jar:7.0.65] at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703) ~[catalina.jar:7.0.65] at org.springframework.util.ClassUtils.forName(ClassUtils.java:274) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:437) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1428) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1372) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  </code></pre>
  
  <p>Contents of the pom.xml file are as follows:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.moglix.ecom.search.api&lt;/groupId&gt;
      &lt;artifactId&gt;api&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;api&lt;/name&gt;
      &lt;url&gt;http://www.moglix.com&lt;/url&gt;
      &lt;parent&gt;
          &lt;groupId&gt;com.moglix.ecom&lt;/groupId&gt;
          &lt;artifactId&gt;search&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;slf4j.version&gt;1.7.12&lt;/slf4j.version&gt;
          &lt;logback.version&gt;1.1.3&lt;/logback.version&gt;
          &lt;spring.data.version&gt;5.0.7.RELEASE&lt;/spring.data.version&gt;
          &lt;spring.version&gt;5.0.7.RELEASE&lt;/spring.version&gt;
          &lt;elastic-search.version&gt;1.7.1&lt;/elastic-search.version&gt;
          &lt;junit.version&gt;4.12&lt;/junit.version&gt;
          &lt;quartz.version&gt;1.6.1&lt;/quartz.version&gt;
          &lt;supercsv.version&gt;2.1.0&lt;/supercsv.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
              &lt;version&gt;2.12.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-mongodb --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-mongodb&lt;/artifactId&gt;
              &lt;version&gt;2.0.8.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-commons&lt;/artifactId&gt;
              &lt;version&gt;2.0.8.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
              &lt;version&gt;1.7.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
              &lt;version&gt;1.8&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-redis&lt;/artifactId&gt;
              &lt;version&gt;1.0.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;redis.clients&lt;/groupId&gt;
              &lt;artifactId&gt;jedis&lt;/artifactId&gt;
              &lt;version&gt;2.0.0&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;taglibs&lt;/groupId&gt;
              &lt;artifactId&gt;standard&lt;/artifactId&gt;
              &lt;version&gt;1.1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.moglix.ecom.search.core&lt;/groupId&gt;
              &lt;artifactId&gt;core&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.moglix.platform.core&lt;/groupId&gt;
              &lt;artifactId&gt;core&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;${junit.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit-dep&lt;/artifactId&gt;
              &lt;version&gt;4.11&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.quartz-scheduler&lt;/groupId&gt;
              &lt;artifactId&gt;quartz&lt;/artifactId&gt;
              &lt;version&gt;2.1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt; 
              &lt;version&gt;${slf4j.version}&lt;/version&gt; &lt;/dependency&gt; --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
              &lt;version&gt;${logback.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-core&lt;/artifactId&gt;
              &lt;version&gt;${logback.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
              &lt;artifactId&gt;groovy-all&lt;/artifactId&gt;
              &lt;version&gt;2.4.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Elastic Search --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.elasticsearch&lt;/groupId&gt;
              &lt;artifactId&gt;elasticsearch&lt;/artifactId&gt;
              &lt;version&gt;${elastic-search.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-elasticsearch&lt;/artifactId&gt;
              &lt;version&gt;1.2.0.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjtools&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- Jackson JSON Mapper --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
              &lt;version&gt;1.9.10&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;2.6.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/com.thetransactioncompany/cors-filter --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.thetransactioncompany&lt;/groupId&gt;
              &lt;artifactId&gt;cors-filter&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;2.6.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
              &lt;version&gt;2.6.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Caching Dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;net.sf.ehcache&lt;/groupId&gt;
              &lt;artifactId&gt;ehcache&lt;/artifactId&gt;
              &lt;version&gt;2.9.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!--Spring caching framework inside this --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!--Support for Ehcache and others --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context-support&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  
      &lt;!-- building --&gt;
      &lt;build&gt;
          &lt;defaultGoal&gt;compile&lt;/defaultGoal&gt;
          &lt;directory&gt;target&lt;/directory&gt;
          &lt;sourceDirectory&gt;src/main/java&lt;/sourceDirectory&gt;
          &lt;outputDirectory&gt;target/classes&lt;/outputDirectory&gt;
          &lt;finalName&gt;searchApi&lt;/finalName&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
          &lt;!-- plugins --&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                      &lt;artifactId&gt;properties-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;1.0-alpha-2&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;pre-clean-config&lt;/id&gt;
                              &lt;phase&gt;pre-clean&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;read-project-properties&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;files&gt;
                                      &lt;file&gt;user.properties&lt;/file&gt;
                                  &lt;/files&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                          &lt;execution&gt;
                              &lt;id&gt;initialize-config&lt;/id&gt;
                              &lt;phase&gt;initialize&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;read-project-properties&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;files&gt;
                                      &lt;file&gt;user.properties&lt;/file&gt;
                                  &lt;/files&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.2.1&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;attach-sources&lt;/id&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;jar&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.12.4&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;skipTests&gt;true&lt;/skipTests&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.9&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;wtpversion&gt;2.0&lt;/wtpversion&gt;
                          &lt;additionalProjectnatures&gt;
                              &lt;projectnature&gt;org.springframework.ide.eclipse.core.springnature&lt;/projectnature&gt;
                          &lt;/additionalProjectnatures&gt;
                          &lt;useProjectReferences&gt;false&lt;/useProjectReferences&gt;
                          &lt;downloadSources&gt;true&lt;/downloadSources&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
  
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Now I am getting following error:</p>
  
  <pre><code>06/07/2018 20:56:46.045 [localhost-startStop-80] ERROR
                  o.s.web.context.ContextLoader.initWebApplicationContext(331) - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.data.mongodb.core.MongoTemplate com.moglix.ecom.es.api.dao.MongoDao.mongoTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [config/META-INF/spring/applicationContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/mapping/context/InvalidPersistentPropertyPath
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003) [catalina.jar:7.0.65]
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517) [catalina.jar:7.0.65]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.65]
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.65]
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.65]
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) [catalina.jar:7.0.65]
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095) [catalina.jar:7.0.65]
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1960) [catalina.jar:7.0.65]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_72]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_72]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_72]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72]
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.data.mongodb.core.MongoTemplate com.moglix.ecom.es.api.dao.MongoDao.mongoTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [config/META-INF/spring/applicationContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/mapping/context/InvalidPersistentPropertyPath
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 26 common frames omitted
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [config/META-INF/spring/applicationContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/mapping/context/InvalidPersistentPropertyPath
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1139) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 28 common frames omitted
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/mapping/context/InvalidPersistentPropertyPath
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 40 common frames omitted
  Caused by: java.lang.NoClassDefFoundError: org/springframework/data/mapping/context/InvalidPersistentPropertyPath
      at org.springframework.data.mongodb.core.convert.MappingMongoConverter.&lt;init&gt;(MappingMongoConverter.java:119) ~[spring-data-mongodb-1.10.3.RELEASE.jar:na]
      at org.springframework.data.mongodb.core.MongoTemplate.getDefaultMongoConverter(MongoTemplate.java:2111) ~[spring-data-mongodb-1.10.3.RELEASE.jar:na]
      at org.springframework.data.mongodb.core.MongoTemplate.&lt;init&gt;(MongoTemplate.java:222) ~[spring-data-mongodb-1.10.3.RELEASE.jar:na]
      at org.springframework.data.mongodb.core.MongoTemplate.&lt;init&gt;(MongoTemplate.java:186) ~[spring-data-mongodb-1.10.3.RELEASE.jar:na]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_72]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_72]
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_72]
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_72]
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 42 common frames omitted
  Caused by: java.lang.ClassNotFoundException: org.springframework.data.mapping.context.InvalidPersistentPropertyPath
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854) ~[catalina.jar:7.0.65]
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703) ~[catalina.jar:7.0.65]
      ... 51 common frames omitted
  </code></pre>