目前,我的 API 的 URL 是例如:
/api/users
使用 Spring MVC:
@RequestMapping("/api/users")
我想对这个 api 进行版本控制:
/api-v1.0/users
最好是能够在 @RequestMapping
注释中使用 SpEL,但是 it is unfortunately not possible :
@RequestMapping("/api-#{appProps['version']}/users")
那么还有哪些选择呢?
最佳答案
尝试使用 @RequestMapping("/api-${version}/users")
。
关于java - 如何使用 Spring MVC 对我的 API 进行版本控制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29803015/