web.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  3. <display-name>EMS_Weather</display-name>
  4. <!-- 加载Spring配置 -->
  5. <context-param>
  6. <param-name>contextConfigLocation</param-name>
  7. <param-value>classpath:config/spring/spring-base.xml</param-value>
  8. </context-param>
  9. <!-- 加载Log4j配置 -->
  10. <context-param>
  11. <param-name>log4jConfigLocation</param-name>
  12. <param-value>classpath:config/log4j/log4j.properties</param-value>
  13. </context-param>
  14. <!-- 启动Log4j -->
  15. <listener>
  16. <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  17. </listener>
  18. <!-- 启动Spring -->
  19. <listener>
  20. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  21. </listener>
  22. <!-- 系统初始化 -->
  23. <servlet>
  24. <servlet-name>SystemInitServlet</servlet-name>
  25. <servlet-class>com.persagy.init.SystemInitServlet</servlet-class>
  26. <load-on-startup>0</load-on-startup>
  27. </servlet>
  28. <!-- 解决乱码 -->
  29. <filter>
  30. <filter-name>CharacterEncodingFilter</filter-name>
  31. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  32. <init-param>
  33. <param-name>encoding</param-name>
  34. <param-value>utf-8</param-value>
  35. </init-param>
  36. </filter>
  37. <filter-mapping>
  38. <filter-name>CharacterEncodingFilter</filter-name>
  39. <url-pattern>/*</url-pattern>
  40. </filter-mapping>
  41. <!-- CORS过滤器start -->
  42. <filter>
  43. <filter-name>corsFilter</filter-name>
  44. <filter-class>com.persagy.filter.CorsFilter</filter-class>
  45. </filter>
  46. <filter-mapping>
  47. <filter-name>corsFilter</filter-name>
  48. <url-pattern>/*</url-pattern>
  49. </filter-mapping>
  50. <!-- CORS过滤器end -->
  51. <!-- Spring MVC -->
  52. <servlet>
  53. <servlet-name>SpringMVC</servlet-name>
  54. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  55. <init-param>
  56. <param-name>contextConfigLocation</param-name>
  57. <param-value>classpath:config/spring/spring-mvc.xml</param-value>
  58. </init-param>
  59. <load-on-startup>1</load-on-startup>
  60. </servlet>
  61. <servlet-mapping>
  62. <servlet-name>SpringMVC</servlet-name>
  63. <url-pattern>/Spring/MVC/*</url-pattern>
  64. </servlet-mapping>
  65. </web-app>