Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the process of adding custom methods to all repositories [DATACMNS-542] #1012

Closed
spring-projects-issues opened this issue Jul 17, 2014 · 0 comments
Assignees
Labels
in: repository Repositories abstraction type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Oliver Drotbohm opened DATACMNS-542 and commented

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.

Changes required:

  • 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)

Optional changes:

  • 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)

Issue Links:

  • DATACASS-214 Adapt API to API changes in Spring Data Commons
    ("is depended on by")

  • DATAJPA-674 Problems following the documentation for adding custom behaviour to all repositories

  • DATACASS-211 Adapt to changes in Spring Data Commons

  • DATAES-162 Adapt API changes in Spring Data Commons to simplify custom repository base class registration

  • DATAGRAPH-617 Adapt API changes in Spring Data Commons to simplify custom repository base class registration

  • DATAJPA-710 Adapt API changes in Spring Data Commons to simplify custom repository base class registration

  • DATAMONGO-1211 Adapt API changes in Spring Data Commons to simplify custom repository base class registration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository Repositories abstraction type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants