-
Couldn't load subscription status.
- Fork 38.8k
Description
David Cole opened SPR-13882 and commented
I had opened a ticket in Spring-Boot on this topic and it was suggested I create one on the Spring JIRA I have added the original ticket as the Reference URL.
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.
The result would be, using the example above, that my request mapping would be defined as:
@RequestMapping(path="controller1") The resulting URL would resolve to:
/<root_context>/api/controller1
I was hoping for more of a 'building block' approach, like:
@RequestMapping(path="/api")
class BaseController{
....
}
@RequestMapping(path="sub-class1")
class SubClassedController1 extends BaseController{
@RequestMapping(path="get-something")
public void getSomething(){
...
}
}
@RequestMapping(path="sub-class2")
class SubClassedController2 extends BaseController{
@RequestMapping(path="get-something")
public void getSomething(){
...
}
}Resulting in
/api/sub-class1/get-something
and
/api/sub-class2/get-something
Affects: 4.2.3, 5.0.1
Reference URL: spring-projects/spring-boot#4994
Issue Links:
- Ability to provide an external base path for controllers [SPR-16336] #20883 Ability to provide an external base path for controllers ("is superseded by")
6 votes, 12 watchers