Request method ‘GET’ not supported – Http Status 405

In spring boot, if the requested url is not configured as ‘GET’ call in rest controller, PageNotFound : Request method ‘GET’ not supported exception will be thrown from the application. It also throws org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘GET’ not supported in spring boot as the method is not available in spring boot application.



Exception

2019-10-04 17:39:32.012  WARN 2448 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound             : Request method 'GET' not supported
 2019-10-04 17:39:32.034  WARN 2448 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]


How to reproduce this issue

In the spring boot rest controller class, remove one of the url in a method. If you access the url from the browser or postman, This warning will be shown in the log.



Root Cause

The accessed url should match any one of the url configured in the rest controller class. This issue is thrown due to non availability of the url in the rest controller class.



Solution 1

The url may be wrong in the browser or postman. Check the mistakes in the accessed url in the browser.



Solution 2

The accessed url is not configured in rest controller. Check in the rest controller class url configurations and http access methods.



Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *