[org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'xxx ' is not present]
springframeworkWeb string not is 39 org
2023-09-14 09:08:18 时间
1、Spring Boot项目,发起Post请求,解决Required String parameter xxx is not present类型异常。
1 2021-03-29 08:43:52 - [http-nio-8082-exec-1] - WARN - o.s.w.s.m.support.DefaultHandlerExceptionResolver - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'xxx ' is not present] 2 2021-03-29 08:43:52 - [http-nio-8082-exec-1] - DEBUG - org.springframework.web.servlet.DispatcherServlet - Completed 400 BAD_REQUEST 3 2021-03-29 08:43:52 - [http-nio-8082-exec-1] - DEBUG - org.springframework.web.servlet.DispatcherServlet - "ERROR" dispatch for POST "/error", parameters={masked} 4 2021-03-29 08:43:52 - [http-nio-8082-exec-1] - DEBUG - o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest) 5 2021-03-29 08:43:52 - [http-nio-8082-exec-1] - DEBUG - o.s.w.s.m.m.annotation.HttpEntityMethodProcessor - Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json] 6 2021-03-29 08:43:52 - [http-nio-8082-exec-1] - DEBUG - o.s.w.s.m.m.annotation.HttpEntityMethodProcessor - Writing [{timestamp=Mon Mar 29 20:43:52 CST 2021, status=400, error=Bad Request, message=, path=/api/offlineE (truncated)...] 7 2021-03-29 08:43:52 - [http-nio-8082-exec-1] - DEBUG - org.springframework.web.servlet.DispatcherServlet - Exiting from "ERROR" dispatch, status 400
其实,这个错误九成的原因,就是请求参数和@RequestParam(value = "userName ", required = true) String userName,注解@RequestParam的value值不一样的,我写的就奇葩了,字符串后面加了空格。
相关文章
- Springboot 问题: required a bean of type 'org.springframework.scheduling.TaskScheduler' that could not be found.
- nested exception is java.lang.NoClassDefFoundError: org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter
- org.springframework.transaction 包改成 spring-tx
- Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed
- springframework maven地址
- 解决org.openqa.selenium.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms org.springframework.beans.BeanInstantiation
- 解决org.springframework.web.multipart.MaxUploadSizeExceededException
- 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 解决org.openqa.selenium.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms org.springframework.beans.BeanInstantiation
- 【已解】Nacos Unable to start web server; nested exception is org.springframework.boot.web.server.WebSer
- org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.logException Resolved
- org.springframework.beans.factory.BeanDefinitionStoreException
- java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener问题解决
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type '' available: expected at least 1 bean which qualifies as autowire candidate.
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- SpringBoot工程启动报错No bean named ‘org.springframework.context.xxxxx.importRegistry‘ available
- spring事务报错Error occured processing XML org/springframework/aop/config/AopNamespaceUtils,See Error
- Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException