What dependency is missing for org.springframework.web.bind.annotation.RequestMapping?

后端 未结 16 2047
名媛妹妹
名媛妹妹 2020-12-28 13:52

What dependency am I missing? I am currently using:


    org.springframework
    spring-w         


        
相关标签:
16条回答
  • 2020-12-28 14:06

    I think You are using Spring 3.0.5 and you need to use Spring 4.0.* This will resolve your problem. org.springframework.web.bind.annotation.RequestMapping is not available in Spring-web earlier then Spring-web 4.0.*

    0 讨论(0)
  • 2020-12-28 14:08

    Thanks above all of you contributions! however for my case I finally realized that my dependency above "spring-web" was destroyed on my .m2/repository/org/springframework/spring-web, I just deleted the folder and update Maven again. it got fixed.

    0 讨论(0)
  • 2020-12-28 14:09

    Step 1 - The problem is with Eclipse IDE Step 2 - Right Click Maven Dependencies -> Build Path -> Remove Build Path

    Update pom.xml for spring-web and spring-webmvc

    Step 3 - Update Maven Dependencies

    You will see the Spring-Web files will be in the maven dependencies folder.

    0 讨论(0)
  • 2020-12-28 14:11

    I had the same problem. After spending hours, I came across the solution that I already added dependency for "spring-webmvc" but missed for "spring-web". So just add the below dependency to resolve this issue. If you already have, just update both to the latest version. It will work for sure.

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.1.6.RELEASE</version>
    </dependency>
    

    You could update the version to "5.1.2" or latest. I used V4.1.6 therefore the build was failing, because this is an old version (one might face compatibility issues).

    0 讨论(0)
  • 2020-12-28 14:11
    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
    0 讨论(0)
  • 2020-12-28 14:13

    I was using spring-web version 4.3.7

    Changing it to a working 4.1.7 immediately solved it.

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>4.1.7.RELEASE</version>
        </dependency>
    
    0 讨论(0)
提交回复
热议问题