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

  • 相关阅读:
    整数参数求和
    《Objective-C 程序设计》读后感
    构建之法前三章精读读后感
    《java编程思想》读后感
    《JAVA核心技术》观后感
    构建之法读后感
    一、构建之法读后感
    开发MIS系统需要的技术及其含义、作用
    阅读笔记一
    Java课后练习9(异常处理)
  • 原文地址:https://www.cnblogs.com/rogge7/p/7050480.html
Copyright © 2011-2022 走看看