-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Support default URI prefix for web service @RequestMapping #4994
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
Comments
The approach that was suggested on the, now deleted, answer on Stack Overflow should work. Annotate a base class at the class level with |
Interesting. I wasn't aware you could do that. However, that still wouldn't be a great solution for me.
Resulting in That seems more natural to me. |
@lewisdavidcole I can certainly see how the behaviour you have described could be useful. Unfortunately, it's pretty much out of Spring Boot's control as it's Spring MVC that defines this behavior and it isn't configurable. Please open a Spring MVC JIRA ticket (https://jira.spring.io/browse/SPR) if you'd like to see this enhancement. |
There doesn't seem to be anyway, short of explicitly prefixing each individual
@RequestMapping
with a default URI like@RequestMapping(path="**/api**/controller1"
at the top of the@RestController
class, where**/api**
is the default. I'm trying to have a clear separation in URL paths between normal application requests and web service requests, allowing me to provide additional security specific to web services.I have an ongoing StackOverflow post, with no meaningful solution to-date and would like to suggest an enhancement to allow a default URI prefix to be supported somewhere in the Spring Boot application.properties configuration.
http://stackoverflow.com/questions/34801351/how-to-configure-a-default-restcontroller-uri-prefix-for-all-controllers
The result would be, using the example above, that my request mapping would be defined as:
The resulting URL would resolve to
> /<root_context>/api/controller1
The text was updated successfully, but these errors were encountered: