<hades:dao-config> needed with @Repository scanning?

Added by Jeff Jensen 9 months ago

If I have this:

1   <context:component-scan base-package="packagename.persistence" 
2     use-default-filters="false">
3     <context:include-filter type="annotation" 
4       expression="org.springframework.stereotype.Repository" />
5   </context:component-scan>

Is this still needed?

1 <hades:dao-config base-package="packagename.persistence" />

Conversely, it seems the hades configuration needs to replace the Spring scan?

Is it in the plans to support @Repository (scan on it vs types)? I did not see an enhancement request.


Replies

RE: <hades:dao-config> needed with @Repository scanning? - Added by Oliver Gierke 7 months ago

Hey Jeff,

unfortunately we won't be able to reduce our scanning to the lookup of @Repository as only the DAO base class is annotated with it and not the individual DAO interfaces created by the user. But these are the citizens we have to take a look at. Furthermore Hades scanning includes some further lookups (e.g. of custom implementation classes) and registering beans. Having that said, it's worth mentioning that we of course use Springs API to component detection extensively under the hood.

Maybe yet another fact. As we derive crucial information from the extension of GenericDao (mainly the generic types) so that only an @Repository would not be enough. Introducing a custom annotation carrying the type information, e.g. GenericDao(domainClass = Foo.class, idClass = Long.class, wouldn't work out, too, as we need the generification on the method level, too.

Maybe you thought about something different?

Regards,
Ollie