正文
org.springframework.web.util.IntrospectorCleanupListener
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc-servlet.xml
1
springmvc
/
两个listener不是必须的,但是servlet是必须的,url-pattern用于开发者选择哪些路径是需要让Spring MVC来处理的。接着在classpath下按照我们约定的名字springmvc-servlet.xml写一个xml文件:
xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd">
另外,由于使用了Spring,所以Tomcat启动的时候默认会去WEB-INF下找applicationContext.xml,所以放一个空的applicationContext.xml到WEB-INF下: