@PreAuthorize("hasRole('ROLE_group1')")
    @RequestMapping(value = "/api/todolist", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<String> updateTodoItem(@RequestBody TodoItem item) {
        final List<TodoItem> find =
                todoList.stream().filter(i -> i.getID() == item.getID()).collect(Collectors.toList());
        if (!find.isEmpty()) {
            todoList.set(todoList.indexOf(find.get(0)), item);
            return new ResponseEntity<>("Entity is updated", HttpStatus.OK);
        }
        return new ResponseEntity<>("Entity not found", HttpStatus.OK);
    }
@PreAuthorize("hasRole('ROLE_group1')")
    @RequestMapping(value = "/api/todolist", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<String> updateTodoItem(@RequestBody TodoItem item) {
        final List<TodoItem> find =
                todoList.stream().filter(i -> i.getID() == item.getID()).collect(Collectors.toList());
        if (!find.isEmpty()) {
            todoList.set(todoList.indexOf(find.get(0)), item);
            return new ResponseEntity<>("Entity is updated", HttpStatus.OK);
        }
        return new ResponseEntity<>("Entity not found", HttpStatus.OK);
    }
@ PreAuthorize ( "hasRole('ROLE_group1')" ) @ RequestMapping ( value = "/api/todolist" , method = RequestMethod . PUT , consumes = MediaType . APPLICATION_JSON_VALUE ) public ResponseEntity < String > updateTodoItem ( @ RequestBody TodoItem item ) { final List < TodoItem > find = todoList . stream ( ) . filter ( i -> i . getID ( ) == item . getID ( ) ) . collect ( Collectors . toList ( ) ) ; if ( ! find . isEmpty ( ) ) { todoList . set ( todoList . indexOf ( find . get ( 0 ) ) , item ) ; return new ResponseEntity <> ( "Entity is updated" , HttpStatus . OK ) ; } return new ResponseEntity <> ( "Entity not found" , HttpStatus . OK ) ; }
HTTP PUT
HTTP PUT