-
Notifications
You must be signed in to change notification settings - Fork 683
Fallback to default fragment implementation if no candidates found #3018
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
Conversation
It's an enhancement that should not break existing behaviors. The default implementation is `$FragmentInterfaceName + $ImplementationPostfix`, for example `com.example.FragmentImpl` is the default implementation of `com.example.Fragment`. It's useful for sharing repository fragments as library, application doesn't have to include library package in `@Enable…Repositories`, and it will back off if application provides custom implementation. See spring-projects/spring-data-jpa#3287
Thanks for your suggestion. We need to discuss in the team whether we want to support external fragments and how discovery is affected with a fragment implementation inside the base package vs. a fragment implementation that resides in the package the interface is defined in. |
Any thoughts? |
We've introduced #3090 to register fragments by specifying implementations in Care to check out #3090? It allows you to specify an implementation for a fragment interface. Once the fragment interface is used in a repository, you will get the fragment implementation that is associated with it. |
Same-package default implementation is unique, could you explain why it's random?
in |
The opposite is true. We're adding means of configuration for arrangements that require a more explicit configuration. Scanning outside the base package would strongly deviate from our conventions. By broadening scanning locations to interfaces imported into a repository declaration we would ignore configuration. That being said, we're closing this PR in favor of #3090. |
It's an enhancement that should not break existing behaviors.
The default implementation is
$FragmentInterfaceName + $ImplementationPostfix
, for examplecom.example.FragmentImpl
is the default implementation ofcom.example.Fragment
.It's useful for sharing repository fragments as library, application doesn't have to include library package in
@Enable…Repositories
, and it will back off if application provides custom implementation.See spring-projects/spring-data-jpa#3287