-
用spring rest客户端 restTemplate.postForObject(serverUrl, map, String.class)0
我在客户端用spring rest客户端 restTemplate.postForObject(serverUrl, map, String.class)请求,map中的参数被序列化为JSON格式,如下:
{"format":"json","id":"1","address":"{\"zoneCode\":\"10000\",\"doorCode\":\"20000\",\"streets\":[{\"no\":\"111\",\"name\":\"abc\"}],"name":"wgw","pass":"123"},在服务端做转换时,spring用的是jackson,代码如下
@RequestMapping(value = "/", method = RequestMethod.POST)
public Result getUser(@RequestBody User user) {
User user1 = new User();
user1.setId(1l);
user1.setName("www");
}
其中User有一个复合属性Address,始终报org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not instantiate value of type [simple type, class com.mms.cod.controller.Address] from String value ('{"zoneCode":"10000","doorCode":"20000","streets":[{"no":"111","name":"abc"}],"codes":["a","b"]}'); no single-String constructor/factory method (through reference chain: com.mms.cod.controller.User["address"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class com.mms.cod.controller.Address] from String value ('{"zoneCode":"10000","doorCode":"20000","streets":[{"no":"111","name":"abc"}],"codes":["a","b"]}'); no single-String constructor/factory method (through reference chain: com.mms.cod.controller.User["address"]),求帮助2014年6月09日 09:37
目前还没有答案
相关推荐
org.springframework.mock.jndi.ExpectedLookupTemplate.class org.springframework.mock.jndi.SimpleNamingContext.class org.springframework.mock.jndi.SimpleNamingContextBuilder.class org.springframework....
org.springframework.remoting.caucho.BurlapClientInterceptor.class org.springframework.remoting.caucho.BurlapProxyFactoryBean.class org.springframework.remoting.caucho.BurlapServiceExporter.class org....
return restTemplate.getForObject(serverurl,String.class); } private Integer requestCount = 1; @RequestMapping("/getServerurl") public String getServerurl(){ List<ServiceInstance> ...
RestTemplate是执行HTTP请求的同步阻塞式的客户端,它在HTTP客户端库(例如JDK HttpURLConnection,Apache HttpComponents,okHttp等)基础封装了更加简单易用的模板方法API。也就是说RestTemplate是一个封装,底层...
META-INF/MANIFEST.MForg.springframework.web.struts.ActionServletAwareProcessor.class org.springframework.web.struts.ActionSupport.class org.springframework.web.struts.AutowiringRequestProcessor.class ...
org.springframework.web.jar
Spring REST is a practical guide for designing and developing RESTful APIs using the Spring Framework. This book walks you through the process of designing and building a REST application while taking...
org.springframework.instrument.classloading-3.0.0.M4.jar
Error creating bean with name 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0' defined in ServletContext resource [/WEB-INF/springMVC-servlet.xml]: Initialization of bean failed;...
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
16.1.2. How Spring supports REST 16.2. Creating your first REST endpoint 16.2.1. Negotiating resource representation 16.2.2. Working with HTTP message converters 16.3. Serving more than resources ...
org.springframework.aop-3.0.4.RELEASE.jar org.springframework.asm-3.0.4.RELEASE.jar org.springframework.aspects-3.0.4.RELEASE.jar org.springframework.beans-3.0.4.RELEASE.jar org.springframework....
spring.jar spring-aop.jar spring-aop.jar spring-beans.jar spring-hibernate3.jar spring-jdbc.jar spring-struts.jar spring-web.jar
Auto-configured Spring REST Docs Tests with REST Assured 43.3.20. User Configuration and Slicing 43.3.21. Using Spock to Test Spring Boot Applications 43.4. Test Utilities 43.4.1. ...
* is a Map, allowing the use of multiple objects keyed by name. * * @author Rod Johnson * @author Juergen Hoeller * @author Rob Harrop * @see DispatcherServlet * @see ViewResolver * @see ...
spring-web.jar spring-webmvc.jar spring mvc框架需要用到的
spring 3.2.4 Realease 的所有jar包: spring-context-3.2.4.RELEASE.jar spring-core-3.2.4.RELEASE.jar spring-beans-3.2.4.RELEASE.jar spring-test-3.2.4.RELEASE.jar spring-web-3.2.4.RELEASE.jar spring-aop-...
Class'org.springframework.orm.hibernate3.LocalSessionFactoryBean'not found 解决办法
其中包含有org.springframework.orm.hibernate3.support.HibernateDaoSupport.class,
Spring REST Docs。 官网 Spring REST Docs API。 Spring REST Docs 开发文档。