Skip to content

disableDefaultExposure breaks ListPagingAndSortingRepository #2457

Open

Description

@xanscale

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

Activity

  1. xanscale commented on Feb 12, 2025

    @xanscale
    Author

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

  2. xanscale commented on Mar 4, 2025

    @xanscale
    Author

    @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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions