开发常用的springmvc.xml配置文件,spring 3.0 spring-servlet.xml配置。

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Bean头部 -->
  3. <beans xmlns="http://www.springframework.org/schema/beans"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:p="http://www.springframework.org/schema/p"
  6. xmlns:mvc="http://www.springframework.org/schema/mvc"
  7. xmlns:context="http://www.springframework.org/schema/context"
  8. xmlns:util="http://www.springframework.org/schema/util"
  9. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  10. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
  11. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
  12. http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
  13. <!-- 加载权限设置 -->
  14. <bean id="security" class="com.boaotech.util.Security"
  15. p:contextConfigLocation="WEB-INF/security.xml" />
  16. <!-- 加载菜单项 -->
  17. <bean id="menus" class="com.boaotech.util.Menus"
  18. p:contextConfigLocation="WEB-INF/menus.xml" p:security-ref="security" />
  19. <!-- Json返回格式化转换 -->
  20. <bean id="mappingJacksonHttpMessageConverter"
  21. class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
  22. <!-- 设置全局日期参数的字符串表示格式 -->
  23. <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
  24. <property name="webBindingInitializer">
  25. <bean class="com.boaotech.util.CommonBindingInitializer"/>
  26. </property>
  27. <property name="messageConverters">
  28. <list>
  29. <ref bean="mappingJacksonHttpMessageConverter"/>
  30. </list>
  31. </property>
  32. </bean>
  33. <!-- 激活@Controller模式 -->
  34. <mvc:annotation-driven />
  35. <!-- 对包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能  需要更改-->
  36. <context:component-scan base-package="com.boaotech.zhaotaoerp" />
  37. <context:annotation-config/>
  38. <!-- 激活计划任务注解 -->
  39. <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
  40. <task:scheduler id="myScheduler" pool-size="1"/>
  41. <task:executor id="myExecutor" pool-size="1"/>
  42. <!-- 配置拦截器 -->
  43. <mvc:interceptors>
  44. <bean id="authorizeInterceptor" class="com.boaotech.util.AuthorizeInterceptor" />
  45. </mvc:interceptors>
  46. <!-- 类名到视图名的自动映射 -->
  47. <!-- bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/ -->
  48. <!-- FreeMarker配置文件 -->
  49. <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
  50. <property name="templateLoaderPath" value="/WEB-INF/ftl/"/>
  51. <property name="freemarkerSettings">
  52. <props>
  53. <prop key="template_update_delay">5</prop>
  54. <prop key="default_encoding">UTF-8</prop>
  55. <prop key="locale">zh_CN</prop>
  56. </props>
  57. </property>
  58. </bean>
  59. <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
  60. <bean id="viewResolver"
  61. class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"
  62. p:cache="true" p:prefix="" p:suffix=".ftl"
  63. p:contentType="text/html;charset=UTF-8"
  64. p:exposeRequestAttributes="true" p:exposeSessionAttributes="true"
  65. />
  66. <!-- bean id="viewResolver"
  67. class="org.springframework.web.servlet.view.InternalResourceViewResolver"
  68. p:viewClass="org.springframework.web.servlet.view.JstlView" p:prefix="/WEB-INF/jsp/"
  69. p:suffix=".jsp" / -->
  70. </beans>
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Bean头部 -->
  3. <beans xmlns="http://www.springframework.org/schema/beans"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:p="http://www.springframework.org/schema/p"
  6. xmlns:mvc="http://www.springframework.org/schema/mvc"
  7. xmlns:context="http://www.springframework.org/schema/context"
  8. xmlns:util="http://www.springframework.org/schema/util"
  9. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  10. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
  11. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
  12. http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
  13. <!-- 加载权限设置 -->
  14. <bean id="security" class="com.boaotech.util.Security"
  15. p:contextConfigLocation="WEB-INF/security.xml" />
  16. <!-- 加载菜单项 -->
  17. <bean id="menus" class="com.boaotech.util.Menus"
  18. p:contextConfigLocation="WEB-INF/menus.xml" p:security-ref="security" />
  19. <!-- Json返回格式化转换 -->
  20. <bean id="mappingJacksonHttpMessageConverter"
  21. class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
  22. <!-- 设置全局日期参数的字符串表示格式 -->
  23. <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
  24. <property name="webBindingInitializer">
  25. <bean class="com.boaotech.util.CommonBindingInitializer"/>
  26. </property>
  27. <property name="messageConverters">
  28. <list>
  29. <ref bean="mappingJacksonHttpMessageConverter"/>
  30. </list>
  31. </property>
  32. </bean>
  33. <!-- 激活@Controller模式 -->
  34. <mvc:annotation-driven />
  35. <!-- 对包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能  需要更改-->
  36. <context:component-scan base-package="com.boaotech.zhaotaoerp" />
  37. <context:annotation-config/>
  38. <!-- 激活计划任务注解 -->
  39. <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
  40. <task:scheduler id="myScheduler" pool-size="1"/>
  41. <task:executor id="myExecutor" pool-size="1"/>
  42. <!-- 配置拦截器 -->
  43. <mvc:interceptors>
  44. <bean id="authorizeInterceptor" class="com.boaotech.util.AuthorizeInterceptor" />
  45. </mvc:interceptors>
  46. <!-- 类名到视图名的自动映射 -->
  47. <!-- bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/ -->
  48. <!-- FreeMarker配置文件 -->
  49. <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
  50. <property name="templateLoaderPath" value="/WEB-INF/ftl/"/>
  51. <property name="freemarkerSettings">
  52. <props>
  53. <prop key="template_update_delay">5</prop>
  54. <prop key="default_encoding">UTF-8</prop>
  55. <prop key="locale">zh_CN</prop>
  56. </props>
  57. </property>
  58. </bean>
  59. <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
  60. <bean id="viewResolver"
  61. class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"
  62. p:cache="true" p:prefix="" p:suffix=".ftl"
  63. p:contentType="text/html;charset=UTF-8"
  64. p:exposeRequestAttributes="true" p:exposeSessionAttributes="true"
  65. />
  66. <!-- bean id="viewResolver"
  67. class="org.springframework.web.servlet.view.InternalResourceViewResolver"
  68. p:viewClass="org.springframework.web.servlet.view.JstlView" p:prefix="/WEB-INF/jsp/"
  69. p:suffix=".jsp" / -->
  70. </beans>

关于springmvc的配置文件的更多相关文章

  1. 3.SpringMVC修改配置文件路径和给界面传递数据

    1.修改配置文件路径  达到  配置多文件的目的 web.xml文件中基础配置有springMVC配置的servlet路径 <servlet-name>SpringMVC</serv ...

  2. SpringMVC深度探险(四) —— SpringMVC核心配置文件详解

    在上一篇文章中,我们从DispatcherServlet谈起,最终为读者详细分析了SpringMVC的初始化主线的全部过程.整个初始化主线的研究,其实始终围绕着DispatcherServlet.We ...

  3. ssm框架 spring的主配置文件 spring-mvc主配置文件 web.xml配置文件(基础的配置文件)

    1.spring主配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...

  4. (转)SpringMVC学习(三)——SpringMVC的配置文件

    http://blog.csdn.net/yerenyuan_pku/article/details/72231527 读者阅读过SpringMVC学习(一)——SpringMVC介绍与入门这篇文章后 ...

  5. Spring+SpringMVC整合----配置文件

    1.在 web.xml 中加载 spring 的配置文件 bean.xml    底层是 Listener <!-- Spring --> <context-param> &l ...

  6. 加载自定义目录下的springmvc.xml配置文件

    在默认情况下:springmvc框架的配置文件必须叫<servlet-name>-servlet.xml 且必须放在/WEB-INF/目录下,我们可以在web.xml文件中,为Dispat ...

  7. springMVC项目配置文件

    一.springMVC项目配置文件 1.web.xml文件全局配置 <servlet> <servlet-name> dispatcher </servlet-name& ...

  8. spring-mvc.xml配置文件出错

    在整合ssm三大框架的时候,配置spring-mvc.xml的文件的 <mvc:default-servlet-handler/> <mvc:annotation-driven /& ...

  9. Spring+SpringMVC重复加载配置文件问题

    sping+springmvc的框架中,IOC容器的加载过程 http://my.oschina.net/xianggao/blog/596476 基本上是先加载ContextLoaderListen ...

随机推荐

  1. XML.01-语法简介

    body,td { font-family: calibri; font-size: 10pt }   XML.01-语法简介 文档声明 元素(标签) 属性 注释 特殊字符 CDATA区域 处理指令 ...

  2. 【转载】[C#]Log4net中的RollingFileAppender解析

    Log4日志组件的应用确实简单实用,在比较了企业库和Log4的日志功能后,个人觉得Log4的功能更加强大点.补充说明下,我使用的企业库是2.0版本,Log4net是1.2.1版本的. 在Log4net ...

  3. C#中有哪些类型的数组

    一维数组(Single-Dimensional)多维数组(Multidimensional)交错数组(Jagged arrays):交错数组是元素为数组的数组.交错数组元素的维度和大小可以不同.交错数 ...

  4. Windows下Eclipse+Scala+Spark开发环境搭建

    1.安装JDK及配置java环境变量 本文使用版本为jdk1.7.0_79,过程略 2.安装scala 本文使用版本为2.11.8,过程略 3.安装spark 本文使用版本为spark-2.0.1-b ...

  5. HMC破解控制台密码

    一般我们装完HMC以后默认的登录控制台的账户是:admin 密码:abc123当我们可以自创建登录账户后,忘记密码了怎么办? 这里有两种方法: 1 由于HMC是suse系统,基于linux内核的,所以 ...

  6. vim使用命令

    * 向前搜索当前单词 # 向后搜索当前单词 n 和 shift n(N) 向后向前跳到所匹配的单词处 C-f  page down;  C-b page up C-o 回到上次位置 C-i   &qu ...

  7. .NET 配置项扩展

    using System; using System.Configuration; namespace ConsoleApplication3 { /* web.config 或 app.config ...

  8. 【网络编程/C++】修改本机ip地址

    昨天学会了编程实现获取本地网卡信息,今天再接再砺学会了修改本机ip地址.其实原理很简单就是用c++调用一下dos命令而已,不得不说,dos命令实在是太强大了,当然听说还有种修改注册表的方法,不过没有试 ...

  9. 建筑材料系统 ASP.NET MVC4.0 + WebAPI + EasyUI + Knockout 的架构设计开发

    框架介绍: 1.基于 ASP.NET MVC4.0 + WebAPI + EasyUI + Knockout 的架构设计开发 2.采用MVC的框架模式,具有耦合性低.重用性高.生命周期成本低.可维护性 ...

  10. gson基本使用

    http://www.jianshu.com/p/d62c2be60617 http://blog.csdn.net/lk_blog/article/details/7685169