springboot访问方法时出错:Spring Boot Application: No converter found for return value of type
2018-01-17 16:32
731 查看
http://blog.csdn.net/followshadow/article/details/54973112
出错的原因是因为maven依赖的jar包没有json相关的jar包,需要引入相关json的jar包
Controller:
出错的原因是因为maven依赖的jar包没有json相关的jar包,需要引入相关json的jar包
<!-- 对象与JSON之间相互转换 --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.7.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.7.3</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.23</version> </dependency>
Controller:
@RequestMapping("/say") public Users sayHello() { Users users = new Users(); users.setId(0001); users.setUserName("李白"); return users; }
显示的结果:
{"id":1,"userName":"李白"}依赖json的包可以自动进行类型转换
相关文章推荐
- springboot访问方法时出错:Spring Boot Application: No converter found for return value of type
- springboot访问方法时出错:Spring Boot Application: No converter found for return value of type
- spring boot:No converter found for return value of type: class另类解决办法
- springboot错误 java.lang.IllegalArgumentException:No converter found for return value of type
- Spring MVC No converter found for return value of type 解决方法
- Spring MVC No converter found for return value of type 解决方法
- No converter found for return value of type: class org.json.JSONArray解决方法
- No converter found for return value of type解决方法
- Spring MVC No converter found for return value of type
- 使用Spring Cloud微服务框架进行多个微服务整合时出现No converter found for return value of type:xxx异常信息
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.Has
- SpringMVC 返回json数据报错IllegalArgumentException: No converter found for return value of type:xxx
- No converter found for return value of type: class com.alibaba.fastjson.JSONObject MappingJackson2Ht
- java.lang.IllegalArgumentException: No converter found for return value of type:class 解决方案
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.Has
- springMVC返回json格式数据报错:No converter found for return value of type: class java.util.HashMap
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.Has
- 关于ssm分布式项目中的No converter found for return value of type问题
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.Has
- 解决java.lang.IllegalArgumentException: No converter found for return value of type: class java.util