springmvc配置文件解析

<context:annotation-config />
<!-- 注解探测器  自动扫描的包名   -->
<context:component-scan base-package="www.**.controller"/>
<!-- 启动Spring MVC的注解功能 -->
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/>

<!--  被淘汰的配置   -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

<!-- 默认的注解映射的支持 -->
<mvc:annotation-driven/>


<!-- 对静态资源文件的访问   公司的实现方式      --> 
<mvc:resources location="/admin/" mapping="/ajax/js/**" />
<mvc:resources location="/admin/" mapping="/images/**" />
<mvc:resources location="/admin/cargo" mapping="/admin/cargo/*.htm" />

<!-- 视图解释类 --> 
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
<property name="prefix" value="/"/> 
<property name="suffix" value=".jsp"/><!--可为空,方便实现自已的依据扩展名来选择视图解释类的逻辑  -->
<!-- jinp 新增   -->
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> 
</bean>

<!-- 对静态资源文件的访问   方案二:   
<mvc:resources mapping="/images/**" location="/images/" />
-->
<!-- 对静态资源文件的访问   方案三
<mvc:default-servlet-handler/>
-->


<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">           
<property name="maxUploadSize" value="104857600"/>       
<property name="maxInMemorySize" value="4096"/>
</bean>

<!-- 请求拦截     -->
<mvc:interceptors>
<!-- 使用bean定义一个Interceptor,直接定义在mvc:interceptors根下面的Interceptor将拦截所有的请求 -->
<bean class="www.baidu.com.util.SpringMVCInterceptor"/>
<!-- 定义在mvc:interceptor下面的表示是对特定的请求才进行拦截的
<mvc:interceptor>
<mvc:mapping path="/admin/editOutBoundUrl.mmx"/>
<bean class="www.baidu.com.interceptor.OutBoundUrlInterceptor"/>
</mvc:interceptor>
-->
</mvc:interceptors>

<!-- 总错误处理      
<bean id="exceptionResolver" class="com.mmb.framework.support.SpringMVCException">
<property name="defaultErrorView"> 
<value>/error/error</value>
</property>
<property name="defaultStatusCode"> 
<value>500</value>
</property>
<property name="warnLogCategory"> 
<value>com.mmb.framework.support.SpringMVCException</value>
</property>
</bean>
-->
<!-- 总错误处理-->
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="defaultErrorView"> 
<value>/error/error</value>
</property>
<property name="defaultStatusCode"> 
<value>500</value>
</property>
<property name="warnLogCategory"> 
<value>org.springframework.web.servlet.handler.SimpleMappingExceptionResolver</value>
</property>
</bean>


<!-- 多视图处理器 -->
<bean class="com.xxx.core.web.MixedViewResolver">
<property name="resolvers">
<map>
<entry key="jsp">
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
</bean>
</entry>
<entry key="ftl">
<bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="cache" value="true"/>
<property name="contentType" value="text/html;charset=UTF-8"></property>
<!-- 宏命令的支持  --> 
<property name="exposeSpringMacroHelpers" value="true"/>
<property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView"/>
<property name="requestContextAttribute" value="rc"></property>
</bean>
</entry>
</map>
</property>
</bean>

<!-- freemarker config -->
<bean id="freeMarkerConfigurer" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/ftl/" />
<property name="freemarkerSettings">
    <props>
<prop key="template_update_delay">5</prop>
<prop key="default_encoding">UTF-8</prop>
<prop key="locale">zh_CN</prop>
    </props>
</property>
</bean>

你可能感兴趣的:(spring,mvc,springMVC)