spring MVC 4.3.1和jackson2.5.0总是出问题
功能只想能输出json数据
工具: idea 2016.2.1 没有mevan构建,直接引用jar包, spring MVC 4.3.1和 jackson2.5 (jackson-annotations-2.5.0.jar 、jackson-core-2.5.0.jar、jackson-databind-2.5.0.jar), 用的tomcat8.5
java文件:
spring配置文件
工具: idea 2016.2.1 没有mevan构建,直接引用jar包, spring MVC 4.3.1和 jackson2.5 (jackson-annotations-2.5.0.jar 、jackson-core-2.5.0.jar、jackson-databind-2.5.0.jar), 用的tomcat8.5
java文件:
@Controller
public class UserController {
@RequestMapping(value="/user", method= RequestMethod.GET)
public @ResponseBody User hello() throws IOException {
User user = new User();
user.setName("test");
user.setPassword("123");
return user;
}
}
spring配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
<context:component-scan base-package="com.test" />
<bean id = "User" class="com.test.User"></bean>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"></bean>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"></bean>
<!-- ViewResolver -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
...全文
相关推荐
spring jar包
NULL 博文链接:https://myzhuguohua.iteye.com/blog/1611745
[享学Jackson] 十六、Jackson在Spring MVC中的使用之Date、JSR310时间类型的处理
由于我们很少(并不代表没有)单独去使用Jackson库,所以从此篇文章开始聚焦于更具有实践意义的场景:Jackson在Spring生态下的运用。 虽然现在`Spring Boot`非常流行,但我并不会一上来就向大家介绍更加工程化的它。因为`Spring Boot`仍还是构建在Spring之上的应用,所以如果仅仅是告诉大家如何使用似乎违背了我做此专栏的初心。所以我就遵循我的一贯习惯:**从更为底层出发,深入了解然后釜底抽薪,剩下来的便可无师自通**。 强调说明:**本文的讲解基于的是`Spring MVC
SSM框架整合jar包
ssm框架整合之后的常用jar包
spring4 jackson2.5.3.jar 包
Spring4.x.x MVC 中使用jackson的包进行json转换。需要的jar包
Spring4.2.9+mybatis3.4.4集成(整合Jackson版)支持JDK1.6、Tomcat6
如果您基于Java6(JDK1.6)开发项目,这应该是目前最新的版本了。


Web 开发
