[英]Spring 4: Multiple base path in one controller
I have a question about Spring 4. My controller is accessible from a URL, but I want to have a second URL where only the beginning is different to access the same endpoints of this controller. I have a question about Spring 4. My controller is accessible from a URL, but I want to have a second URL where only the beginning is different to access the same endpoints of this controller.
Here is my controller:这是我的 controller:
@RestController("MyController")
@RequestMapping(value={"/abc/def/ghi","/ijk/def/ghi"})
public class MyController {
// code continuation
But I get this error message.但我收到此错误消息。
Multiple class level mappings defined on class com.MyController
Did I miss something?我错过了什么? Thanks.谢谢。
Edit: as M. Dudek mentioned, it was indeed necessary to upgrade Hateoas.编辑:正如 M. Dudek 所说,确实有必要升级 Hateoas。
maybe this?也许这个?
@RestController("MyController")
@RequestMapping(value={"/abc/def/ghi","/ijk/def/ghi"})
public class MyController {
// code continuation
@RequestMapping
has a String[]
value
parameter (not values
), so you should be able to specify multiple values like this: @RequestMapping
有一个String[]
value
参数(不是values
),所以你应该能够像这样指定多个值:
@RequestMapping(value={"/abc/def/ghi"},{"/ijk/def/ghi"})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.