0
回答
SpringMVC纯注解配置下HttpMessageConverter不起作用
ajax访问,但是一直返回406

Controller返回vo通过@ResponseBody标识

@RequestMapping(value = "signin", method = RequestMethod.POST)
@ResponseBody
public ResultVo login(@RequestParam("username") String username, @RequestParam("password") String password, HttpSession session) {
	String pwd = MD5.MD5Encode(password);
	ResultVo vo = mUserService.login(username, pwd);
	if (vo.getStatus() == AppConstant.RESULT_STATUS_SUCCESS) {
			
	}
	return vo;
}

SpringMVC注解配置——节选

@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
	Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder().indentOutput(true).dateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).modulesToInstall(new ParameterNamesModule());
	converters.add(new MappingJackson2HttpMessageConverter(builder.build()));
}



但是不管怎么配置,从jdk1.7升级到1.8后还是不行,只是返回406,而且配置了SpringMVC拦截器也发现根本不进postHandle方法,怎么办

举报
HaydnSyx
发帖于2年前 0回/482阅
顶部