내가 처리기 메서드스프링 MVC RestController 모호한 PathVariable 매핑
@RestController
public class TestController {
...
@GetMapping(name = "/test")
public Test testMethod() {
return testService.getTest();
}
@GetMapping(name = "/test/{count}")
public List<Test> getTestList2(@PathVariable(name = "count") Integer count) {
return testService.getTestList(count);
}
}
GET 2 을 그리고 오류 얻을 : 나는 하나의 방법을 언급하는 경우
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'testController' method
public java.util.List<models.Test> TestController.getTestList2(java.lang.Integer)
to {[],methods=[GET]}: There is already 'testController' bean method
이 모든 일을 잘
HTTP 지정 항상 바람직 모든 : // localhost를 : 8080/테스트를? count = 3 not worked – ip696
@ ip696 올바른 URL을 치지 않고 있습니다. \t ** localhost : 8080/test/3 **이어야합니다. 어쨌든 나는 답을 다시 썼다. 그것을 다시 읽고 시도하십시오. 그것은 당신의 문제를 해결해야합니다. –
@ ip696 이것은 아무런 반응이 없으면 어리 석다. 당신은 도움을 구하고 공동체 또한 원합니다. 다시 읽어 보시고 도움이된다고 생각하시면 도움을 받으십시오. –