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

disableDefaultExposure breaks ListPagingAndSortingRepository #2457

Open
xanscale opened this issue Jan 23, 2025 · 2 comments
Open

disableDefaultExposure breaks ListPagingAndSortingRepository #2457

xanscale opened this issue Jan 23, 2025 · 2 comments
Assignees
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@xanscale
Copy link

xanscale commented Jan 23, 2025

if you are using disableDefaultExposure just if you add ListPagingAndSortingRepository as interface of your repository (together with ListCrudRepository or not) it breaks all rest visibility of annotated methods

@RepositoryRestResource
public interface CourseRepository extends ListCrudRepository<Course, Long> {
    @NotNull @Override @RestResource List<Course> findAll();
}

o.s.web.servlet.DispatcherServlet        : GET "/courses", parameters={}
m.m.a.RequestResponseBodyMethodProcessor : Using 'application/prs.hal-forms+json', given [application/prs.hal-forms+json, application/hal+json, application/json, */*] and supported [application/hal+json, application/json, application/prs.hal-forms+json]
m.m.a.RequestResponseBodyMethodProcessor : HalFormsRejectingResponseBodyAdvice - Changing content type to 'application/hal+json' as no affordances were registered on the representation model to be rendered
m.m.a.RequestResponseBodyMethodProcessor : Writing [CollectionModel { content: [EntityModel { content: ...Course@3 (truncated)...]
o.s.web.servlet.DispatcherServlet        : Completed 200 OK

@RepositoryRestResource
public interface CourseRepository extends ListCrudRepository<Course, Long>, ListPagingAndSortingRepository<Course, Long> {
    @NotNull @Override @RestResource List<Course> findAll();
}

o.s.web.servlet.DispatcherServlet        : GET "/courses", parameters={}
.m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler org.springframework.data.rest.webmvc.RepositoryRestExceptionHandler#handle(HttpRequestMethodNotSupportedException)
o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Using 'application/prs.hal-forms+json', given [application/prs.hal-forms+json, application/hal+json, application/json, */*] and supported [application/json, application/*+json]
o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Nothing to write: null body
.m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' is not supported]
o.s.web.servlet.DispatcherServlet        : Completed 405 METHOD_NOT_ALLOWED

if i remove disableDefaultExposure all works, but i need to manage permission on all methods

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 23, 2025
@xanscale
Copy link
Author

@odrotbohm any news?
i need to use ListPagingAndSortingRepository without exposing everything by default

@xanscale
Copy link
Author

xanscale commented Mar 4, 2025

@mp911de for me seams a huge bug: seams we cant use paging without exposing all repository methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants