SpringMVC配置文件

springMVC-servlet.xml springMVC配置 放在resources下


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd">
    
    

    
    <context:component-scan base-package="com.j3071.oneshop.controller"/>
    
    <mvc:annotation-driven>
        
        <mvc:message-converters register-defaults="false">
            
            <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
            <bean class="org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter"/>
            <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
            <bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter"/>
            
            <bean id="fastJsonHttpMessageConverter"
                  class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
                
                <property name="supportedMediaTypes">
                    <list>
                        
                        <value>text/html;charset=UTF-8value>
                        <value>application/json;charset=UTF-8value>
                    list>
                property>
                <property name="fastJsonConfig">
                    <bean class="com.alibaba.fastjson.support.config.FastJsonConfig">
                        <property name="serializerFeatures">
                            <list>
                                <value>WriteMapNullValuevalue>
                                <value>WriteNullNumberAsZerovalue>
                                <value>WriteNullListAsEmptyvalue>
                                <value>WriteNullStringAsEmptyvalue>
                                <value>WriteNullBooleanAsFalsevalue>
                                <value>WriteDateUseDateFormatvalue>
                            list>
                        property>
                    bean>
                property>

            bean>
        mvc:message-converters>
    mvc:annotation-driven>

    
    
    <mvc:resources mapping="/css/**" location="/css/"/>
    <mvc:resources mapping="/images/**" location="/images/"/>
    <mvc:resources mapping="/js/**" location="/js/"/>
    <mvc:resources mapping="/fonts/**" location="/fonts/"/>

    
    

    
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/"/>
        <property name="suffix" value=".jsp"/>
    bean>
    
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="20000000"/>
        <property name="defaultEncoding" value="utf-8"/>
    bean>


beans>

你可能感兴趣的:(SpringMVC,java,spring)