Request method 'GET' not supported org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported code example

Example: Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported] on @DeleteMapping

@RequestMapping(value="/empdelete/{id}", method=RequestMethod.DELETE)
public void deleteEmployee( PathVariable(“id”) Long id) {
    collaborateurRepository.deleteById(id);
}
//method={RequestMethod.DELETE, RequestMethod.GET}
=> changing for this GET method works fine

Tags:

Java Example