分布式项目开发-springmvc.xmll基础配置

基础步骤:

1 包扫描

2 驱动开发

3 视图解析器

4 文件上传解析器

5 拦截器

6 静态资源



<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> <!-- 1 包扫描 --> <context:component-scan base-package="com.sxt.controller"/> <!-- 2 注解开发 --> <mvc:annotation-driven/> <!-- 3 视图解析器 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF"/> <property name="suffix" value=".jsp"/> </bean> <!-- 4 文件上传解析器 --> <bean name="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="defaultEncoding" value="utf-8"/> <!-- 使用的是字节 50M --> <property name="maxUploadSize" value="52428800"/> <!-- 可以设置一个临时的目录 uploadTempDir,但是注意,我们以上文件不放在tomcat ,需要放在文件 --> </bean> <!-- 5 拦截器 --> <!-- 6 静态资源 --> <mvc:resources location="/WEB-INF/statics/" mapping="/**"></mvc:resources> </beans>

 

posted @ 2019-05-13 23:05  稷下  阅读(248)  评论(0编辑  收藏  举报