I have the following mongo configuration:
<context:component-scan base-package="com.example" />
<mongo:repositories base-package="com.example.repositories.mongodb" />
I have the repository as follows:
package com.example.repositories.mongodb;
public interface ReviewRepository extends CrudRepository<Review, String> {...}
and the bean:
package com.example.domain;
@Document(collection="Review")
public class Review implements Serializable { ... }
Unfortunately, when I start the app, I get the following exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.example.repositories.mongodb.ReviewRepository com.example.Controller.reviewRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reviewRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Not an managed type: class com.example.domain.Review
....
Caused by: java.lang.IllegalArgumentException: Not an managed type: class com.example.domain.Review
I think that this might be caused by the repository and the bean it manages not being in the same package. But I get the same issue also when I do place them in the same package. Any ideas?