-
Couldn't load subscription status.
- Fork 38.8k
Description
Caleb Cushing opened SPR-16336 and commented
I'm certain wrote, or commented on a similar bug that I currently can't find. I'd like the ability to do this with classes annotated with @Controller, and perhaps separately for @RestController.
@Configuration
class RestConfig extends RepositoryRestConfigurerAdapter {
public void configureRepositoryRestConfiguration( RepositoryRestConfiguration config ) {
config.setBasePath( Routes.PRIVATE );
}
}
in this way one could write a generic controller with a known subpath, such as /register, but then attach it in the final application as, in my case, /v0/public/register. Suggestions for more flexibility might be a way to setBasePath, explicitly based on annotation.
so you could write config.setBasePath( PublicController.class, "/v0/public" ) where @PublicController is an extension of @Controller, or maybe it'd just be a good idea to allow it for the specific class instead
one of the reasons I have this problem is I'm modularizing all of my components, but now I have to ensure that these paths are configured properly for hateoas before writing a controller, because the controllers path is static, thus changes to hateoas roots for links have to be made before the controller for tests. If I could change the base path of the controller later then I could bundle the controllers under a configuration, and they'd be more reusable modules between apps, and completely configurable.
Affects: 5.0.2
Issue Links:
- "No matching handler" when override method getServletMapping() in AbstractAnnotationConfigDispatcherHandlerInitializer" [SPR-16143] #20691 "No matching handler" when override method getServletMapping() in AbstractAnnotationConfigDispatcherHandlerInitializer"
- support for providing a path component on a package-info [SPR-14667] #19231 support for providing a path component on a package-info ("supersedes")
- Support default URI prefix for web service @RequestMapping [SPR-13882] #18455 Support default URI prefix for web service
@RequestMapping("supersedes") - Handle @RequestMapping at package level [SPR-15913] #20467 Handle
@RequestMappingat package level ("supersedes")
Referenced from: commits 58cce61, 928b780, 86c8615, d196cdc, 19dc981, 31159a8, e6fef95
2 votes, 7 watchers