spring-projects / spring-projects/spring-data-rest
Adding RequestMapping("/**") overrides spring data rest base path [DATAREST-940]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Florian opened DATAREST-940 and commented
Hello,
I have a simple Spring Boot app with a CrudRepository annotated with @RepositoryRestResource to enable REST services on that repository.
I also customized the REST API base path with the following configuration:
spring:
data:
rest:
base-path: /api
In the other hand, I got a custom @RestController with @RequestMapping("/**") because my app need to catch all pathes (except the /api path).
The thing is, /** is matching everything even my API path. So I'am unable to request my API.
Is that the desired behavior ?
Is there any way to make /** not matching /api, or make the RepositoryRestResource match first ?
I tried the following without success:
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
super.addResourceHandlers(registry);
}
}
Affects: 2.5.4 (Hopper SR4)
2 votes, 2 watchers
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.