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

Fragment implementations no longer found after upgrading to 2.1.x.RELEASE [DATACMNS-1487] #1922

Closed
spring-projects-issues opened this issue Mar 2, 2019 · 4 comments
Assignees
Labels
in: repository status: declined type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Mar 2, 2019

Paul Warren opened DATACMNS-1487 and commented

I have a library that adds versioning to spring data repositories via a re-usable fragment. Developers make their repository extend my fragment VersioningRepository and they can then version their entities.

Currently I support Spring Data Commons 2.0.x.RELEASE. With this release when a Developer extends my VersioningRepository fragment the implementation is found because, I believe, this method uses  FragmentMetadata.getBasePackages() that returns the package of the fragment interface and as the implementation is in the same/sub package the classpath scan finds it.

However, with the 2.1.0.RELEASE release the implementation is not found because, I believe, this commit changed the scanning algorithm that now seems to use the "base package" specifications on the @EnableXYZRepositories annotations.

This means, to use my fragment Developers have to also specify my fragment's package in their @EnableJpaRepositories annotation (for example). Or, if they are using Spring Boot and don't specify this annotation at all, the fragment implementation just isn't found.

 

I have reproduced the problem with this repo.
 


Affects: 2.1.5 (Lovelace SR5)

Reference URL: https://github.com/paulcwarren/DATACMNS-1487

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 2, 2019

Paul Warren commented

I created this partial code fix.  

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 3, 2019

Oliver Drotbohm commented

That works as expected. We introduced the change to avoid superfluous classpath scans as they have a significant performance impact especially in applications that do no use fragments at all as the scans have to be executed for every candidate repository but will not return any results. The provided patch would just reintroduce the expensive behavior we needed to get rid off in the first place.

The documentation never actually implied that fragment implementations could live outside the package context defined by @Enable…Repositories

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 4, 2019

Paul Warren commented

Seems reasonable Oliver Drotbohm. Thanks

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 4, 2019

Paul Warren commented

I can't close this so I'll have to let you do it

@spring-projects-issues spring-projects-issues added type: bug status: declined in: repository labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository status: declined type: bug
Projects
None yet
Development

No branches or pull requests

2 participants