SpringBoot提示错误:HttpRequestMethodNotSupportedException: Request method ‘GET‘ not supported

springboot在测试连接数据时,提示错误:Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘GET’ not supported]

意思是不支持get方法。也就是说当前方法是post类型,而我们用一个get连接请求了这个方法,当然会报错。

大概率是方法前的注解类型写错了

将@PostMapping改为 @GetMapping或者@RequestMapping即可。

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/c2e0d48172.html