spring框架的web.xml文件解读
来源:互联网 发布:2017沥青路面设计软件 编辑:程序博客网 时间:2024/06/05 17:41
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <listener> <!-- 在web.xml中注册这个listener可以保证在web应用关闭的时候释放掉与这个web应用相关的class loader和由它管理的类. --> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> <!-- 以防乱码 --> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>*</url-pattern> </filter-mapping> <!-- 如果spring配置文件被命名为applicationContext.xml,并且放在WEB-INF目录下,则不需要配置<context-param>, 因为ContextLoaderListener默认在WEB-INF目录下寻找名为applicationContext.xml的文件。 若要放于WEB-INF/classes/目录下,或若存在多个Spring配置文件,则需要上面的配置,且在<param-value>中依次列出,之间以逗号隔开。也可以不用逗号 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/classes/conf/spring/spring-admin.xml, /WEB-INF/classes/conf/spring/applicationContext-security.xml </param-value> </context-param> <!-- ContextLoaderListener通过读取contextConfigLocation参数来读取配置参数,一般来说它配置的是Spring项目的中间层,服务层组件的注入,装配,AOP. 对应到Spring的自动装配机制<context:component-scan>就是以下几种注解的装配 DAO: such as @Repository bean Entity: such as @Entity bean Service: such as @Service bean ContextLoaderListener,它实现了ServletContextListener监听器接口, ServletContextListener只负责监听web容器启动和关闭的事件 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 而RequestContextListener实现ServletRequestListener监听器接口,该监听器监听HTTP请求事件,web服务器 接收的每一次请求都会通知该监听器。 --> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <!-- 这个监听器实现了HttpSessionListener接口,主要监听sessionCreated、sessionDestroyed事件。 可统计在线人数清除已经失效的session信息以及session对应的认证实体信息,避免造成oom --> <listener> <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> </listener> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>sitemeshFilter</filter-name> <filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class> </filter> <filter-mapping> <filter-name>sitemeshFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemeshFilter</filter-name> <url-pattern>*.htm</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemeshFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>springMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> classpath*:/conf/spring/spring-quartz.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springMVC</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> <session-config> <session-timeout>30</session-timeout> </session-config> <error-page> <error-code>404</error-code> <location>/pages/exception/pageNotFound.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/pages/exception/pageError.jsp</location> </error-page> <!-- <welcome-file-list> <welcome-file>/auth/login.htm</welcome-file> </welcome-file-list> --> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping></web-app>
阅读全文
0 0
- spring框架的web.xml文件解读
- web.xml文件解读
- spring.xml等xml文件的注解解读
- web.xml详细解读(flex项目,框架:cairngorm--blazeDS--spring--ibatis)(正在编写中)
- Spring-MVC框架下对web.xml文件及spring_mvc.xml文件内容的释义资料整理
- Web项目使用Spring框架服务器启动加载xml文件的过程学习
- 在搭建Spring框架时,web.xml文件的配置之DispatcherServlet&ContextLoaderListener
- Web框架Spring-rest-data解读
- Spring常用的web.xml文件配置
- Spring框架web.xml模板
- 基于IntelliJ IDEA上创建Maven Spring MVC项目web.xml文件解读
- 项目架构分析-web.xml文件解读
- log4j的xml文件解读
- spring框架下 web.xml注解的使用
- spring框架中web.xml的配置详解
- spring 框架的xml文件如何读取properties文件数据
- spring 框架的xml文件如何读取properties文件数据
- spring 框架的xml文件如何读取properties文件数据
- JavaScript的null与undefined的区别
- java按汉字首字母排序
- C# 如何把DataGridView导入到PDF表格
- -bash: /usr/local/java/jdk1.8.0_144/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file
- BZOJ 1635: [Usaco2007 Jan]Tallest Cow 最高的牛
- spring框架的web.xml文件解读
- java 将微信录音amr转换为mp3格式,谨防大坑
- 纸牌游戏
- MVP架构模式详解
- PHP魔术方法
- 编码问题,unicode,string
- Spring Boot UnitTest
- Java多线程学习笔记(三)
- MySQL-查询MySQL最后几条数据-不依赖其它字段