springmvc.xml配置及说明

4 篇文章 0 订阅
<?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 https://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 http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">

	<!-- 启用spring mvc 注解 -->
	<context:annotation-config />
	<!-- 配置控制器扫描: controller包 -->
	<context:component-scan base-package="com.gh" use-default-filters="false">
		<!--只扫描控制器-->
		<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
	</context:component-scan>

	<context:property-placeholder location="classpath:video.properties"/>

	<!--两个标准配置  -->
	<!-- 将springmvc不能处理的请求交给tomcat -->
	<mvc:default-servlet-handler/>
	<!-- 配置注解驱动:用于代替映射器、适配器,支持springmvc更高级的功能:JSR303校验、快捷ajax、映射动态请求等 -->
	<mvc:annotation-driven/>

	<!--配置拦截器:对静态资源放行-->
	<mvc:resources mapping="/ccs/**" location="/css/"/>
	<mvc:resources mapping="/fonts/**" location="/fonts/"/>
	<mvc:resources mapping="/js/**" location="/js/"/>


	<!-- 完成请求和注解POJO的映射 注:org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter已废弃-->
	<!--<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"></bean>-->

	<!-- 配置视图解析器:prefix:前缀, suffix:后缀 -->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<!--  配置前、后缀,前缀:JSP页面所在路径,后缀:是否是jsp页面 -->
		<property name="prefix" value="/"></property><!--在路径后多加了条杠-->
		<property name="suffix" value=".jsp"></property>
	</bean>

	<!-- 文件解析器 -->
	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="defaultEncoding" value="UTF-8"></property>
		<!-- 指定所上传的总大小不能超过xxx(B)。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件 这里设置了10个G -->
		<property name="maxUploadSize" value="10995116277760"></property>
	</bean>

	<!-- <bean id="jacksonMessageConverter"
		class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
		<property name = supportedMediaTypes ">
			<list>
				<value>text/html;charset=UTF-8</value>
			</list>
		</property>
		<property name="supportedMediaTypes"> 
		<list> 
		<value>text/html;charset=UTF-8</value> 
		</list> 
		</property> 
	</bean> -->

</beans>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值