spring-servlet.xml
<?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: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.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd"> <!-- 开启spring mvc 注释 -->
<!-- <mvc:annotation-driven></mvc:annotation-driven> --> <!-- 开启自定义注释 -->
<mvc:annotation-driven validator="validator" /> <bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:i18n/zn</value>
</list>
</property>
<property name="useCodeAsDefaultMessage" value="true" />
</bean> <bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
<!-- 这里配置将使用上面国际化配置的messageSource -->
<property name="validationMessageSource" ref="messageSource" />
</bean> <!--定义spring mvc 扫描包 -->
<context:component-scan base-package="com.csit.springmvc.controllers"></context:component-scan> <!-- ViewResolver 配置 页面信息 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean> <!-- 支持上传文件 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver" /> <!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
<bean id="mappingJacksonHttpMessageConverter"
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean> <bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="mappingJacksonHttpMessageConverter" /><!-- json转换器 -->
</list>
</property>
</bean> <!-- 定义拦截器 -->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/router/**" />
<!-- 定义在mvc:interceptor下面的表示是对特定的请求才进行拦截的 -->
<bean class="com.csit.springmvc.interceptor.SpringMVCInterceptor" />
</mvc:interceptor>
</mvc:interceptors> <!-- 前后缀映射 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB_INF/view"></property>
<property name="suffix" value=".jsp"></property>
</bean> <!-- 处理静态资源 -->
<mvc:default-servlet-handler />
</beans>
spring-servlet.xml的更多相关文章
- spring web.xml 难点配置总结
web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...
- Spring 通过XML配置文件以及通过注解形式来AOP 来实现前置,环绕,异常通知,返回后通知,后通知
本节主要内容: 一.Spring 通过XML配置文件形式来AOP 来实现前置,环绕,异常通知 1. Spring AOP 前置通知 XML配置使用案例 2. Spring AOP ...
- SPRING IN ACTION 第4版笔记-第七章Advanced Spring MVC-002- 在xml中引用Java配置文件,声明DispatcherServlet、ContextLoaderListener
一.所有声明都用xml 1. <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...
- spring整合mybatis错误:class path resource [config/spring/springmvc.xml] cannot be opened because it does not exist
spring 整合Mybatis 运行环境:jdk1.7.0_17+tomcat 7 + spring:3.2.0 +mybatis:3.2.7+ eclipse 错误:class path reso ...
- spring web.xml 难点配置总结【转】
web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...
- Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc.xml] cannot be opene
Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc. ...
- spring mvc: xml生成
spring mvc: xml生成 准备: javax.xml.bind.annotation.XmlElement; javax.xml.bind.annotation.XmlRootElement ...
- Spring框架xml配置文件 复杂类型属性注入——数组 list map properties DI dependency injection 依赖注入——属性值的注入依赖于建立的对象(堆空间)
Person类中的各种属性写法如下: package com.swift.person; import java.util.Arrays; import java.util.List; import ...
- Spring根据XML配置文件注入对象类型属性
这里有dao.service和Servlet三个地方 通过配过文件xml生成对象,并注入对象类型的属性,降低耦合 dao文件代码: package com.swift; public class Da ...
- java web 加载Spring --web.xml 篇
spring是目前最流行的框架.今天谈谈对spring的认识 起步 javaweb中我们首先会遇到的配置文件就是web.xml,这是javaweb为我们封装的逻辑,不在今天的研究中.略过,下面是一个标 ...
随机推荐
- CF528E Triangles 3000
cf luogu 既然要求三角形面积,不如考虑三角形的面积公式.因为是三条直线,所以可以考虑利用三个交点来算面积,如果这个三角形按照逆时针方向有\(ABC\)三点,那么他的面积为\(\frac{\ve ...
- ES使用text类型字段排序报错
elasticsearch text字段排序报错解决使用elasticsearch 进行排序的时候,我们一般都会排序数字.日期.但是在排序text类型的时候就会出现错误. GET xytest/sut ...
- 【总结】Android 应用测试总结
前提 所有的功能分支已完成 启动: 1. 启动入口:桌面正常启动,最近运行启动,所有程序列表中启动,锁屏快捷启动2. 其他入口:从其他程序开启应用,从外部以文件形式打开应用(如果有)3. 退回:从其他 ...
- [转载](转)ISE中ROM初始化文件(.coe)的建立
原文地址:(转)ISE中ROM初始化文件(.coe)的建立作者:老徐 UltraEdit 对于ROM模块,主要是生成相应的.coe文件. 1.在Matlab中生成正余弦波形的浮点值,并量化为16bit ...
- robotframework 使用Chrome手机模拟器两种方法
Open Google Simulator1 ${device metrics}= Create Dictionary width=${360} height=${640} pixelRatio=${ ...
- controller 有两种写法,讨论一下两种写法的区别:
controller 有两种写法,讨论一下两种写法的区别: 写法 1: app.controller('myCtrl', function($scope, $location) { $scope.my ...
- 利用urllib.urlopen向有道翻译发送数据获得翻译结果
from urllib import request,parseimport requests, sys,ssl,json ssl._create_default_https_context = ss ...
- 安装虚拟环境 virtualenv
前言 玩python 当然需要安装虚拟环境,这样就万一有多个项目,避免会冲突,如何安装 virtualenv: 下面如下: 输入 pip list cmd 你的电脑: 然后 输入 pip list: ...
- ES和RDBMS区别
原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12090637.html ES7.0之前,一个Index可以设置多个Type ES7.0开始,Type已 ...
- [每日一讲] Python系列:字符串(下)
字符串的常见操作 """ DATA STRUCTURE Container: Sequence -- String String is immutable.If stri ...