springboot 动态路径
以前没玩儿过这个,最近有个项目需要根据不同的版本,生成不同的接口地址,代码如下:
@PostMapping("{version}/http-push") public String push(@PathVariable String version, @RequestBody Object pushData) { if(!version.equals(configVersion)){ return ConfigStatic.httpRes(404, "Invalid request path!",null); } }
其中的version就可以自定义了
本文来自博客园,作者:Rolay,转载请注明原文链接:https://www.cnblogs.com/rolayblog/p/17669605.html