The DELETE method is not supported spring boot

using Angular 8 and Springboot app… passing value through JSON getting error: Request delete doesn’t supported here is the error :

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Dec 05 22:55:04 WET 2019 There was an unexpected error (type=Method Not Allowed, status=405). Request method ‘GET’ not supported
Here’s the code :
RequestMapping(value="/empdelete/{id}", method=RequestMethod.DELETE)
public void deleteEmployee( PathVariable(“id”) Long id) {
collaborateurRepository.deleteById(id);

    }

i just delete @ cause they won’t to share it so i delete it

I don’t think I’ve seen this issue with directly spring boot. Are your Angular app and Springboot app served from the same host and port? Are there any proxies in between the user and the Springboot app that might be converting the call (Ive seen this before)?

If you uses three back-ticks “`” before and after a code block it will format it correctly:

@RequestMapping(value="/empdelete/{id}", method=RequestMethod.DELETE)
public void deleteEmployee( PathVariable(“id”) Long id) {
    collaborateurRepository.deleteById(id);
}
1 Like

I solved this issue, by adding GET method cause I just recuperate id of employee entity so I should also add it to method
method={RequestMethod.DELETE, RequestMethod.GET}
And thanks for your answer

This work perfectly for me and help me to debug my application efficiently. Thank you!