If you want to add a single method to all of the repositories declared in your app, you need to follow a 3 step process, e.g. described in the documentation.
Step three is rather awkward and effectively only necessary as we don't know about the exact arguments necessary to construct the store specific factory instance. If implementors provided the arguments and we assume that users stick to exactly that list of arguments (probably a very reasonable assumption) we could add an additional way of customizing the instantiation by exposing a configuration property repositoryBaseClass and reflectively instantiate that one instead of calling the template methods.
- a setter to configure the repository base class on RepositoryFactorySupport
- a template method to let implementors provide constructor arguments for the reflective invocation
- change the behavior of RepositoryFactorySupport.getRepository(…) to prefer the configured type over triggering the repository creation in subclasses.
- expose configuration means in @Enable…Repositories and XML namespace (will require changes to store implementations as well)
- improve the naming of the methods in RepositoryFactorySupport as what's currently called getTargetRepository will become more of a default repository target (used if nothing special is configured)