我以为springframework的版本越高越好,所以我在POM里的版本号写了5.0.4.RELEASE,然后就导致没法使用@Controller和@RequestMapping等注释;

其实,只要改成4.3.14.RELEASE就可以了.

为什么会这样呢?

DispatcherServlet根据原则读取XML配置文件里的定义是这样的:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-4.1.xsd 
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-4.1.xsd 
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">

是不是跟这里的xsd版本有关?