No HttpMessageConverter for java.util.HashMap and content type application/x-www-form-urlencoded

是因为用了HashMap来作为body传递 解析转换不了,换成 MultiValueMap就ok了。
No HttpMessageConverter for java.util.HashMap and content type application/x-www-form-urlencoded_第1张图片
收工

!!getParams实现

/**
 * 基本消息转换器
* @Author xxx * @Date 2020-03-11 */
public class BasicMessageConvert implements HttpMessageConvert { private HttpServletRequest request; public BasicMessageConvert(HttpServletRequest request) { this.request = request; } @Override public MultiValueMap getParams() { MultiValueMap ret = new LinkedMultiValueMap(); Map<String,String[]> map = request.getParameterMap(); for(Iterator<Map.Entry<String, String[]>> itr = map.entrySet().iterator(); itr.hasNext();){ Map.Entry<String, String[]> entry = itr.next(); String key = entry.getKey(); String[] value = entry.getValue(); ret.put(key, new ArrayList(Arrays.asList(value[0]))); } // 提取params参数 extractParams(ret); return ret; } }

你可能感兴趣的:(异常)