Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc 在运行时以编程方式注册路由_Spring Mvc - Fatal编程技术网

Spring mvc 在运行时以编程方式注册路由

Spring mvc 在运行时以编程方式注册路由,spring-mvc,Spring Mvc,我希望能够使用@SomethingProvider注释我的一些控制器,以便它们自动提供POST/{original resource url}/somethingurl,并将此url绑定到通用处理程序 使用具有通配符映射的控制器将不起作用,因为并非所有资源都具有可用的“某物”集合。例: POST /user/something POST /product/something etc. 但不是 POST /anything/something 我的想法是在运行时扫描控制器并查找@Somethi

我希望能够使用@SomethingProvider注释我的一些控制器,以便它们自动提供
POST/{original resource url}/something
url,并将此url绑定到通用处理程序

使用具有通配符映射的控制器将不起作用,因为并非所有资源都具有可用的“某物”集合。例:

POST /user/something
POST /product/something
etc.
但不是

POST /anything/something
我的想法是在运行时扫描控制器并查找
@SomethingProvider
注释,这样我就可以以编程方式注册其他“something”端点

我知道它与
RequestMappingHandlerMapping
有关,但我不知道如何利用它来添加映射

谢谢天才