【问题标题】:import org.springframework.web.bind.annotation.DeleteMapping cannot be resolvedimport org.springframework.web.bind.annotation.DeleteMapping 无法解决
【发布时间】:2018-05-25 15:26:49
【问题描述】:

错误:

导入 org.springframework.web.bind.annotation.DeleteMapping 无法解决

  import org.springframework.web.bind.annotation.DeleteMapping;
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.PostMapping;
    import org.springframework.web.bind.annotation.PutMapping;

Pom.xml

<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>test</groupId>
  <artifactId>test</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>test Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <properties>
        <spring.version>4.0.1.RELEASE</spring.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- Spring dependencies -->

        <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.24</version>
</dependency>

        <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>4.0.1.Final</version>
    </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>
    </dependencies>
  <build>
    <finalName>test</finalName>
  </build>
</project>

/////////////////////////////////////// ///////////////////////////////////////// ///////////////////////////////////////// ///////////////////////////////////////// /////////////////////////////////////////////p>

【问题讨论】:

    标签: spring spring-mvc controller spring-restcontroller


    【解决方案1】:

    这些注解是在4.3.0.RELEASE spring 版本中引入的,将你的 pom.xml 更改为任何版本&gt; 4.3.0.RELEASE,我总是用最新版本编码。

    【讨论】:

      猜你喜欢
      • 2014-09-19
      • 2013-08-20
      • 2014-07-23
      • 2016-11-12
      • 2020-09-01
      • 2017-05-26
      • 1970-01-01
      • 2014-09-15
      • 1970-01-01
      相关资源
      最近更新 更多