标签:
<?xml version="1.0" encoding="UTF-8"?> <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-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> <!-自动扫描controller---> <context:component-scan base-package="com.zenointel.p2p.web.controller"/> <!--验证器--> <mvc:annotation-driven validator="validtor"> <mvc:message-converters> <bean class="org.springframework.http.converter.StringHttpMessageConverter"/> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/> </mvc:message-converters> </mvc:annotation-driven> <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver"> <property name="cookieMaxAge" value="31536000" /> </bean> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <mvc:exclude-mapping path="/services/**"/> <mvc:exclude-mapping path="/css/**"/> <mvc:exclude-mapping path="/js/**"/> <mvc:exclude-mapping path="/img/**"/> <mvc:exclude-mapping path="/fonts/**"/> <mvc:exclude-mapping path="/webfile/**"/> <mvc:exclude-mapping path="/theme/**"/> <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/> </mvc:interceptor> <mvc:interceptor> <mvc:mapping path="/**"/> <mvc:exclude-mapping path="/services/**"/> <mvc:exclude-mapping path="/css/**"/> <mvc:exclude-mapping path="/js/**"/> <mvc:exclude-mapping path="/img/**"/> <mvc:exclude-mapping path="/fonts/**"/> <mvc:exclude-mapping path="/webfile/**"/> <mvc:exclude-mapping path="/theme/**"/> <bean class="com.zenointel.p2p.web.interceptor.P2PInterceptor"/> </mvc:interceptor> </mvc:interceptors> <mvc:resources mapping="/favicon.ico" location="/"/> <mvc:resources mapping="/css/**" location="/css/"/> <mvc:resources mapping="/js/**" location="/js/"/> <mvc:resources mapping="/img/**" location="/img/"/> <mvc:resources mapping="/fonts/**" location="/fonts/"/> <mvc:resources mapping="/theme/**" location="/theme/"/> <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </bean> <bean id="captchaProducer" class="com.google.code.kaptcha.impl.DefaultKaptcha"> <property name="config"> <bean class="com.google.code.kaptcha.util.Config"> <constructor-arg type="java.util.Properties"> <props> <prop key="kaptcha.image.width">100</prop> <prop key="kaptcha.image.height">30</prop> <prop key="kaptcha.textproducer.char.string">0123456789</prop> <prop key="kaptcha.textproducer.char.length">4</prop> <prop key="kaptcha.textproducer.font.size">30</prop> <prop key="kaptcha.textproducer.font.color">black</prop> </props> </constructor-arg> </bean> </property> </bean> <!--================ 中文国际化================--> <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="classpath:messageSource"/> <property name="cacheSeconds" value="300"/> </bean> <bean id="validtor" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"> <property name="validationMessageSource" ref="messageSource"/> </bean> <!--================ 文件上传================--> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="20971520"/> <property name="resolveLazily" value="true"/> </bean> <context:property-placeholder order="1" location="classpath:application.xml" /> <bean id="webConfig" class="com.zenointel.p2p.web.util.WebConfig" /> </beans>
spring mvc配置文件dispatcher-servlet.xml详解
标签:
原文地址:http://www.cnblogs.com/isisbenben/p/5594772.html