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

  • 相关阅读:
    English trip -- VC(情景课)1 A Get ready
    隔板法总结
    CF 题目选做
    ZROI 提高十连测 DAY2
    2019 09 05
    线性基总结
    解决痛苦的方法/cy
    梅深不见冬 树上贪心
    ZROI 提高十连测 Day1
    [USACO09NOV]硬币的游戏 博弈 dp
  • 原文地址:https://www.cnblogs.com/rogge7/p/7050480.html
Copyright © 2011-2022 走看看