spring-projects / spring-projects/spring-data-rest
disableDefaultExposure breaks ListPagingAndSortingRepository
Open
@odrotbohm is already working on this.
Since Jan 27, 2025.
status: waiting-for-triage
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.