Why Spring REST do not analyze "get","post" methods with same url -
i using spring rest , have 2 methods
@requestmapping(value="/",method = requestmethod.post) public @responsebody object test1(httpservletrequest request) {} @requestmapping(value="/",method = requestmethod.get) public @responsebody object test2(httpservletrequest request) {}
but not able detect 2 methods. necessary url should different each http method in spring.
spring can support , post same url. i've done many times. example (this post , put, it's same difference):
@controller @requestmapping(value="player") public class playercontroller { @autowired private playerservice playerservice; @requestmapping(method = requestmethod.post) @responsebody public player createnewplayer(@requestbody player player) { return playerservice.createnewplayer(player); } @requestmapping(method = requestmethod.put) @responsebody public player updateplayer(@requestbody player player) { return playerservice.updateplayer(player); } }
if can post error message you're getting, maybe can figure out what's wrong.
Comments
Post a Comment