#
18516761980
2022-07-26 78423189c7165a5e4bffbfadd5dd181ad9114a2f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?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:context="http://www.springframework.org/schema/context"  
  xmlns:mvc="http://www.springframework.org/schema/mvc"  
  xmlns:websocket="http://www.springframework.org/schema/websocket"  
  xsi:schemaLocation="  
    http://www.springframework.org/schema/beans   
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd  
    http://www.springframework.org/schema/context  
    http://www.springframework.org/schema/context/spring-context-4.0.xsd  
    http://www.springframework.org/schema/mvc  
    http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">  
<!--       <bean id="allBean" class="com.slcf.bean.AllBean"  />  -->
    <!-- 添加注解驱动 -->   
    <!--    <mvc:annotation-driven />   -->
    <mvc:annotation-driven>
        <mvc:message-converters>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter" /> <!--先进行string转换-->
            <bean
                class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="supportedMediaTypes">
                    <list>
                        <value>text/html;charset=UTF-8</value>
                    </list>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>
    <!-- 扫描controller(controller层注入) -->  
   <context:component-scan base-package="com.slcf.controller"/>  
     
      <!-- 不拦截静态资源 -->     
      <mvc:resources location="/images/" mapping="/images/**"></mvc:resources>
      <mvc:resources location="/css/" mapping="/css/**"></mvc:resources>
      <mvc:resources location="/js/" mapping="/js/**"></mvc:resources>     
      <mvc:resources location="/static/" mapping="/static/**"></mvc:resources>
 <!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 -->    
    <bean id="multipartResolver"      
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">      
        <!-- 默认编码 -->    
        <property name="defaultEncoding" value="utf-8" />      
        <!-- 文件大小最大值 -->    
        <property name="maxUploadSize" value="10485760000" />      
        
        <!-- 内存中的最大值 -->    
        <property name="maxInMemorySize" value="40960" />      
    </bean> 
    
     <!-- 避免IE在ajax请求时,返回json出现下载 -->  
   <bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">       
        <property name="supportedMediaTypes">  
            <list>  
                <value>text/html;charset=UTF-8</value>  
            </list>  
        </property>  
    </bean>   
    
    
   <!-- 对模型视图添加前后缀 -->  
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">     
        <property name="prefix" value="/WEB-INF/pages/" />    
        <property name="suffix" value=".jsp" />    
    </bean>    
     
</beans>