zoukankan      html  css  js  c++  java
  • 对象转换为json格式,类似中间层API

    《一头扎进SpringMvc视频教程《一头扎进SpringMvc》第四讲 源码》

    对象自动转换为json格式要在 spring-mvc.xml添加一个东西 ,和对应的命名空间引用和规范,和对应的jar包

    <!-- 支持对象与json的转换。 -->
    <mvc:annotation-driven/>  //注解驱动

    提到目前已经引用了一堆很乱的jar包,maven时就简单了。

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        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">
    
    
    <!-- 支持对象与json的转换。 -->
        <mvc:annotation-driven/>  

    对应的jar包

    jackson-annotations-2.2.1.jar
    jackson-core-2.2.1.jar
    jackson-core-asl-1.8.8.jar
    jackson-databind-2.2.1.jar
    jackson-mapper-asl-1.8.8.jar
    jackson-module-jaxb-annotations-2.2.1.jar

  • 相关阅读:
    [SHOI2008]堵塞的交通
    [SHOI2008]汉诺塔
    [JSOI2008]最小生成树计数
    [JSOI2008]球形空间产生器
    [HNOI2014]画框
    HDU 2255 奔小康赚大钱
    [SDOI2017]新生舞会
    [BZOJ2285][SDOI2011]保密
    [BZOJ3232]圈地游戏
    [HDU5909]Tree Cutting
  • 原文地址:https://www.cnblogs.com/rogge7/p/7050480.html
Copyright © 2011-2022 走看看