小编Mas*_*y24的帖子

package org.springframework.web.bind.annotation does not exist even though it's defined in POM

So I have this code

import org.springframework.web.bind.annotation.GetMapping;
Run Code Online (Sandbox Code Playgroud)

And I already have the following in my POM file

<packaging>war</packaging>
    <properties>
        <spring.version>4.3.0.RELEASE</spring.version>
    </properties>

    <dependencies>
        <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>
Run Code Online (Sandbox Code Playgroud)

Yet when I built it ends up complaining package org.springframework.web.bind.annotation does not exist

Why? I already added spring web as a dependency. What am I doing wrong?

java spring spring-mvc maven spring-web

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

java ×1

maven ×1

spring ×1

spring-mvc ×1

spring-web ×1