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

Add option to disable default exposure of public repository interfaces [DATAREST-473] #852

Closed
spring-projects-issues opened this issue Feb 4, 2015 · 5 comments
Assignees

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Feb 4, 2015

Oliver Drotbohm opened DATAREST-473 and commented

If Spring Data repositories are used in library projects, preventing them from being exposed (i.e. annotating them with @RepositoryRestResource(exported = false) might not be possible.

We should introduce a dedicated configuration option to configure the default exposure for public repository interfaces


Issue Links:

  • LDAP-341 Incompatibility between Spring LDAP 2.0.4.RELEASE and Spring Data Rest 2.4.0.RELEASE (Gosling)
    ("is duplicated by")

Referenced from: commits dc36dfb, f497f40

8 votes, 10 watchers

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 23, 2015

James Carroll commented

We are not explicitly working on a library project, but we do have our project broken down into multiple modules, which presents a similar use case. The repositories are defined in a module that does not require spring-data-rest, and to prevent unnecessary classpath propagation we'd like to avoid pulling this dependency into the module. Currently, we are looking into configuring paths for specific repositories, but with our project's modularity, we would prefer not to use @RepositoryRestResource within our public repository interfaces.

With that said, in addition to introducing a configuration option to set the default exposure, we would also be interested in configurations for setting the rel and path properties for public repository interfaces.

Loading

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jun 16, 2015

Chris Beams commented

Whatever decision gets made about exposing public repository interfaces by default, it should be documented prominently in the Spring Data REST reference docs / getting started guides (these semantics are not documented now).

I just spent a considerable amount of time wondering why none of my repositories were being exported, only to find out that it was because my repositories are package-private. I found this only through trial and error, wondering eventually if visibility might have something to do with it.

The requirement for repositories to be public in order to be exported violated my assumptions because Spring Data JPA and co. have no problem finding and creating implementations for package-private @Repository interfaces.

So while my initial response is that the requirement for repositories to be public should be relaxed, I understand that doing so would probably create compatibility issues. Thus, perhaps clearer documentation is the answer

Loading

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 27, 2015

Sören Chittka commented

It would be very useful when Spring Data providers (e.g. Spring LDAP), that currently do not support exposing their repositories over Spring Data REST could use this option to prevent issues as described in LDAP-341

Loading

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 24, 2015

Tim Meißner commented

Apparently this is handled in the org.springframework.data.rest.core.mapping.RepositoryCollectionResourceMapping class.

Line 72:

this.repositoryIsExportCandidate = Modifier.isPublic(repositoryType.getModifiers());

A new property is introduced easily, but does anyone know a good way to make the RepositoryRestConfiguration available in there to actually use this property?

Loading

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 25, 2015

Oliver Drotbohm commented

That's in place now, see RepositoryRestConfiguration.setRepositoryDetectionStrategy(…)

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants