я сделать запрос на путПочему restTemplate.put() бросает "HttpClientErrorException: 404 Not Found"
RestTemplate restTemplate = new RestTemplate();
restTemplate.put(new URI("http://localhost:8080/test"), dto);
успешно попадает в конечную точку покоя
@RequestMapping(value = "/test", method=RequestMethod.PUT)
public void test123(@RequestBody DTO dto) {
System.out.println("phone:"+dto.getPhone());
}
но "ставить" метод на клиент выдает исключение, хотя сервер успешно ударил, и я не ожидают возвращаемое значение.
Exception in thread "main" org.springframework.web.client.HttpClientErrorException: 404 Not Found
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:589)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:547)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:518)
at org.springframework.web.client.RestTemplate.put(RestTemplate.java:394)
at com.my.Main.main(Main.java:45)
Вы можете поразить URL-адрес: http: // localhost: 8080/test из браузера? –
Не могли бы вы включить весь источник @Controller? –
Я не могу ударить его из браузера: HTTP-статус 405 - Метод запроса «GET» не поддерживается – outdev