Метод «PUT» не поддерживается. 405JAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Метод «PUT» не поддерживается. 405

Сообщение Anonymous »


I am implementing updateUser functionality,i have same endpoint for both get and put, so both were working fine. but suddenly after some time i see that put method stops working. My controller class looks correct, with separate mappings for GET and PUT requests to retrieve and update user details, respectively. Tool used for testing : Postman

Below is my Controller class

@RestController @RequestMapping(path = "/api/users") public class UserRestController { @Autowired UserService userService; @GetMapping("/{userId}") public ResponseEntity getUserById(@PathVariable Long userId) { return userService.getUserById(userId); } @PutMapping("/{userId}") public ResponseEntity updateUser(@PathVariable Long userId, @RequestBody UserDto updateUserDto){ return userService.updateUser(userId, updateUserDto); } }
Изображение


it was working some time before but suddenly it stopped working. is this because i discarded the changes in below file before moving it to staging area?? i am not sure but i think after discarding this only it started giving this error, or is there any other reason.

git checkout -- target/classes/com/clothingstore/userservice/controller/UserRestController.class

i observed after discarding changes i didn't see put method in this file
Изображение



Источник: https://stackoverflow.com/questions/780 ... ported-405
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»