Spring 4.2.0,Hibernate 4.1.4, 这是我的Controller功能:
@RequestMapping(value = "/mobile/getcomp", method = RequestMethod.GET)
@ResponseBody
public List listforCompanies() {
List listOfCompanies= new ArrayList();
listOfCompanies = companyManager.getAllCompanies();
return listOfCompanies;
}
Jackson JSON映射器依赖项Pom.xml:
org.codehaus.jackson
jackson-mapper-asl
${jackson.version}
在清单中获取列表ArrayList,但返回时显示以下错误:
SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with path [/IrApp] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList] with root cause
java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList
at org.springframework.util.Assert.isTrue(Assert.java:68)
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:124)