title: spring data mongo - No bean named 'mongoTemplate' is defined
body: <p>i have a spring data mongo repository class</p>
  
  <pre><code>public interface MyRepository extends MongoRepository&lt;FeedbackDTO, String&gt; {
  }
  </code></pre>
  
  <p>in the test configuration i use the EnableMongoRepositories annotation</p>
  
  <pre><code>@EnableMongoRepositories(basePackages={"com.mypackage.repository.mongodb"})
  public class ServiceTestConfiguration {
  </code></pre>
  
  <p>when i try to test a service class that uses this repository it throws an exception</p>
  
  <blockquote>
    <p>Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'mongoTemplate' is defined
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:698) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1175) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        ... 57 common frames omitted</p>
  </blockquote>