4

I have a Spring Boot application with multiple controllers in a single package. I would like to prepend "/api/" to all @RequestMapping paths and am assuming it is possible to do so in one place. I can't change server.contextPath because I have other things that need to be served from the root context.

Is it possible to do something like this using controller advice?

Any guidance is appreciated.

balduncle
  • 517
  • 6
  • 15

1 Answers1

0

It sounds like you are trying to inherit the request mapping (at least some part of it) on each of your controllers. Checkout this answer for a good code sample: How to inherit RequestMappings in a Spring 3 MVC REST API .

Community
  • 1
  • 1
Ann Addicks
  • 915
  • 12
  • 25