12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
- <!--配置扫描的包-->
- <context:component-scan base-package="com"></context:component-scan>
- <!-- 配置强大的视图解析器-->
- <bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <!-- 前缀-->
- <property name="prefix" value="/WEB-INF/views/"></property>
- <!-- 后缀-->
- <property name="suffix" value=".jsp"></property>
- </bean>
- <!-- id不能随便指定,必须是multipartResolver-->
- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <!-- 默认字符集 utf-8-->
- <property name="defaultEncoding" value="UTF-8"></property>
- <!-- 通过spel表达式设置文件上传的大小 -1不限制-->
- <property name="maxUploadSize" value="#{1024*1024}"></property>
- </bean>
- <!-- 添加注解驱动 注意导以mvc结尾的包-->
- <mvc:annotation-driven></mvc:annotation-driven>
- <!-- 配置全局拦截器-->
- <!-- <mvc:interceptors>-->
- <!-- <bean id="myHandlerInterceptor" class="com.sf.conroller.myHandlerInterceptor"></bean>-->
- <!-- </mvc:interceptors>-->
-
- <!-- 配置拦截一个请求-->
- <mvc:interceptors>
- <mvc:interceptor>
- <mvc:mapping path="/book/getBook"/>
- <bean class="com.sf.conroller.myHandlerInterceptor"></bean>
- </mvc:interceptor>
- </mvc:interceptors>
- </beans>
|