spring-projects / spring-projects/spring-data-rest

Allow user to order rest handler mapping [DATAREST-896]

Open
#1,265 3 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: enhancement
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Petar Tahchiev opened DATAREST-896 and commented

As indicated here

https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMapping.java#L85

the RequestMappingHandlerMapping has order 0.

At the moment DelegatingHandlerMapping is registered with Ordered.LOWEST_PRECEDENCE - 100; so it is always after RequestMappingHandlerMapping. In a typical spring-boot application I would love to be able to configure the order. The best combination in my oppinion would be:

1) Some custom handler mapping or maybe h2-console?
2) Spring boot actuators
3) Spring data rest handler mapping 
4) RequestMappingHanderMapping (has order 0)
5) Static resources

but at the moment it is like this:

1) Some custom handler mapping or maybe h2-console?
2) Spring boot actuators
3) RequestMappingHanderMapping (has order 0)
4) Spring data rest handler mapping 
5) Static resources

In my application I have a DefaultController which always kicks in if there's no controller mapping, so I never get to the REST handler mapping.


Affects: 2.5.2 (Hopper SR2), 2.6 M1 (Ingalls)

3 votes, 6 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.