|
3 | 3 | xmlns:aop="http://www.springframework.org/schema/aop" |
4 | 4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
5 | 5 | xmlns:mvc="http://www.springframework.org/schema/mvc" |
| 6 | + xmlns:context="http://www.springframework.org/schema/context" |
6 | 7 | xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd |
7 | 8 | http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
8 | | - http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> |
| 9 | + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> |
9 | 10 |
|
10 | 11 | <!--<mvc:interceptors>--> |
11 | 12 | <!--<mvc:interceptor>--> |
12 | 13 | <!--<mvc:mapping path="/**"/>--> |
13 | 14 | <!--<bean class="com.giit.www.system.interceptor.LoginIntercepter"/>--> |
14 | 15 | <!--</mvc:interceptor>--> |
15 | 16 | <!--</mvc:interceptors>--> |
| 17 | + <context:component-scan base-package="com.giit.www"> |
| 18 | + <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/> |
| 19 | + <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/> |
| 20 | + </context:component-scan> |
16 | 21 |
|
17 | | - |
| 22 | + <!--自动注册基于注解风格的DefaultAnnotationHandlerMapping和AnotationMethodHandlerAdapter--> |
| 23 | + <!--此处使用conversionService为了自从注册HttpMessageConverter支持@RequestBody和@ResponseBody--> |
18 | 24 | <mvc:annotation-driven conversion-service="conversionService"/> |
19 | 25 |
|
| 26 | + <!--用于解析@RequestBody--> |
| 27 | + <bean id="conversionService" |
| 28 | + class="org.springframework.format.support.FormattingConversionServiceFactoryBean"></bean> |
20 | 29 |
|
| 30 | + <!--视图解析器--> |
21 | 31 | <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> |
22 | 32 | <property name="prefix" value="/WEB-INF/view/"/> |
23 | 33 | <property name="suffix" value=".jsp"/> |
24 | 34 | </bean> |
25 | 35 |
|
26 | | - <bean id="conversionService" |
27 | | - class="org.springframework.format.support.FormattingConversionServiceFactoryBean"></bean> |
28 | | - <import resource="spring.xml"/> |
29 | | - |
| 36 | + <!--多部分解析器,用于解析文件上传时context-type为--> |
| 37 | + <!--Content-Type:multipart/form-data; boundary=...的情况--> |
30 | 38 | <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> |
31 | 39 | <property name="maxUploadSize" value="5242880"/> |
32 | 40 | </bean> |
33 | 41 |
|
| 42 | + <!--第二种处理静态资源的方式--> |
| 43 | + <!--<mvc:default-servlet-handler/>--> |
34 | 44 |
|
35 | | - <!-- 当在web.xml 中 DispatcherServlet使用 <url-pattern>/</url-pattern> 映射时,能映射静态资源 --> |
36 | | - <mvc:default-servlet-handler/> |
37 | | - |
38 | | - <!-- 静态资源映射 --> |
39 | | - <mvc:resources mapping="/static/**" location="/WEB-INF/static/"/> |
| 45 | + <!--第三种静态资源映射--> |
| 46 | + <!--<mvc:resources mapping="/static/**" location="/WEB-INF/static/"/>--> |
40 | 47 |
|
41 | 48 | <import resource="classpath:spring-mvc-shiro.xml"/> |
42 | 49 |
|
|
0 commit comments