<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
		  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
           version="2.5">



     <!--解析Springmvc.xml-->
    <servlet>
        <servlet-name>springmvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

        <!--初始化参数  contextConfigLocation-->
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:springmvc.xml</param-value>
        </init-param>

    </servlet>

    <servlet-mapping>
        <servlet-name>springmvc</servlet-name>
        <!-- / 除了jsp以外的所有资源都可以访问指定的servlet-->
        <url-pattern>/</url-pattern>
    </servlet-mapping>



    <!--解析applicationContext-*.xml文件-->
     <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>classpath:applicationContext-*.xml
         classpath:applicationContext-shiro.xml
         </param-value>

     </context-param>



    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

<!--    注册DelegatingFilterProxy，使用代理把servlet容器中的filter和Spring中的Bean进行连接-->
    <filter>
        <filter-name>shiro</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

<!--        设置为true之后可以使用过滤器中初始化,销毁方法-->
        <init-param>
            <param-name>targetFilterLifecycle</param-name>
            <param-value>true</param-value>
        </init-param>


<!--        给注册了的bean对象起一个名字-->
        <init-param>
            <param-name>targetBeanName</param-name>
            <param-value>shiroFilter</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>shiro</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>
