-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Andy Kriger opened SPR-6978 and commented
Here is a situation that causes a HandlerMethodInvocationException
java.lang.IllegalStateException: Could not find @PathVariable
[type] in @RequestMapping
GET /foo/100 - loadEntity is called
POST /foo/100 - publish is called
GET /module/100 - loadModule is called
POST /module/100 - the exception is caused
Changing the path in either loadModule or publish (ex: loadModule as /q/module/{id}) fixes the problem
It looks like RequestMapping.method is not being prioritized over RequestMapping.value
@Controller
public class MyController
{
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.GET)
public final Object loadEntity(@PathVariable final String type, @PathVariable final long id) { return type + "::" + id; }
@RequestMapping(value = "/module/{id}", method = RequestMethod.GET) public final Object loadModule(@PathVariable final long id) {
return ""+id;
}
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.POST) public final Object publish(@PathVariable final String type,@PathVariable final long id) { return type + "::" + id; }
}
Affects: 3.0.1
Referenced from: commits 4c0744e
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug