zoukankan      html  css  js  c++  java
  • spring.xml配置

    
    
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <beans xmlns="http://www.springframework.org/schema/beans"
     3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     4        xmlns:context="http://www.springframework.org/schema/context"
     5        xmlns:mvc="http://www.springframework.org/schema/mvc"
     6        xsi:schemaLocation="http://www.springframework.org/schema/beans
     7         http://www.springframework.org/schema/beans/spring-beans.xsd
     8         http://www.springframework.org/schema/mvc
     9         http://www.springframework.org/schema/mvc/spring-mvc.xsd
    10         http://www.springframework.org/schema/context
    11         http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    12 
    13     <context:component-scan base-package="com.echo.digital"/>
    14 
    15     <import resource="spring-mybatis.xml"/>
    16 
    17     <mvc:default-servlet-handler/>
    18 
    19     <mvc:annotation-driven/>
    20 
    21     <!--json转换器-->
    22     <mvc:annotation-driven>
    23         <mvc:message-converters>
    24             <bean class="org.springframework.http.converter.StringHttpMessageConverter">
    25                 <!-- <constructor-arg ref="utf8Charset"/> -->
    26                 <!-- <property name="supportedMediaTypes" value = "text/plain;charset=UTF-8" /> -->
    27                 <property name="writeAcceptCharset" value="false" /><!-- 用于避免响应头过大 -->
    28                 <property name = "supportedMediaTypes">
    29                     <list>
    30                         <value>text/plain;charset=UTF-8</value>
    31                         <value>text/html;charset=UTF-8</value>
    32                         <!--                         <value>text/json;charset=UTF-8</value>    -->
    33                     </list>
    34                 </property>
    35             </bean>
    36             <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
    37                 <property name = "supportedMediaTypes">
    38                     <list>
    39                         <value>text/json;charset=UTF-8</value>
    40                     </list>
    41                 </property>
    42 
    43             </bean>
    44         </mvc:message-converters>
    45     </mvc:annotation-driven>
    46 </beans>
    注意:加背景色部分要对,添加错的话会扫描失败
     
    历经苦难而不厌,此乃阿修罗之道。
  • 相关阅读:
    kernel makefile分析 之include路径分析
    python模块,包,安装
    python 资源
    Python版QQ群发消息
    marvell 88f6282 工程包制作
    CPU : 二级缓存容量
    编译多个文件到内核模块
    展布频谱(Spread Spectrum, SS)
    编程练习 链表题目反序,合并
    汇编语言基础之七 框架指针的省略(FPO)
  • 原文地址:https://www.cnblogs.com/echo1314/p/10192692.html
Copyright © 2011-2022 走看看