问题1–@RequestMapping
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘requestMappingHandlerMapping’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘axiosController’ method
- spring容器不能创建对象
问题2–@PostMapping
前端报错
后端报警告
WARN 9800 — [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘POST’ not supported]
使用PostMapping而不是GetMapping
@RequestBody主要用来接收前端传递给后端的json字符串中的数据的(请求体中的数据的),不能直接接受单属性值。