This one has been biting me for a few days; I just had to jot a few notes down about it.
Everywhere you look, the documentation about the <jpa:repositories> spring config element says that the base-package and all subpackages will be scanned for entities that are marked with @Repository (or one of its derived classes). What’s I’ve found is that this just isn’t true. We used:
<jpa:repositories base-package="com.mycompany.foo" .../>
and have a Spring-derived Dao in the com.mycompany.foo.bar package. We end up with an exception in our test case something to the tune of “not an managed type: java.lang.Object”. If, however, we replace the above spring snippet with:
<jpa:repositories base-package="com.mycompany.foo.bar" .../>
then everything is fine.
I wonder if everyone says it scans subpackages, but nobody actually uses it that way?
Note that if you have multiple packages, you can provide a comma-separated list of packages, or (so they say), you can provide a wild-carded base-package. Good luck!