RequestMapping 是否从 Spring 3.2.1 中删除。
我正在开发一个新项目并尝试使用 Spring 3.2.1 ...但是我的 IDEA 和 Maven 在 Spring 中找不到 RequestMapping .. 下面是我的控制器:
package org.sample.jquery.controller;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import static org.apache.log4j.Logger.getLogger;
@Controller
@RequestMapping("/request")
public class RequestController {
private static final Logger LOGGER = getLogger(RequestController.class);
@RequestMapping(method = RequestMethod.GET)
public ModelAndView displayRequestPage() {
return new ModelAndView("input");
}
}
这是我的 pom.xml.... 看起来 RequestMapping 已从 Spring 3.2.1 中删除
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jQueryExamples</groupId>
<artifactId>jQueryExamples</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>jQueryExamples Maven Webapp</name>
<url>http://maven.apache.org</url>
<developers>
<developer>
...
</developer>
</developers>
<properties>
<java-version>1.7</java-version>
<springframework-version>3.2.1.RELEASE</springframework-version>
<org.slf4j-version>1.6.6</org.slf4j-version>
</properties>
<dependencies>
<!-- the following is for spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework-version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- This is for logging with log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- this is for junit testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>jQueryExamples</finalName>
</build>
</project>