org.springframework.web.bind.annotation.RequestMapping缺少什么依赖项? [英] What dependency is missing for org.springframework.web.bind.annotation.RequestMapping?

查看:84
本文介绍了org.springframework.web.bind.annotation.RequestMapping缺少什么依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我缺少什么依赖性?我当前正在使用:

What dependency am I missing? I am currently using:

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

我得到的错误是: 导入org.springframework.web.bind无法解析

The error Im getting is: The import org.springframework.web.bind cannot be resolved

推荐答案

我遇到了同样的问题.花了几个小时后,我遇到了一个解决方案,该解决方案我已经为" spring-webmvc "添加了依赖性,但是却错过了" spring-web "的依赖.因此,只需添加以下依赖项即可解决此问题.如果已经拥有,只需将它们都更新为最新版本.它肯定会工作.

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>

您可以将版本更新为"5.1.2"或最新版本.我使用的是V4.1.6,因此构建失败,因为这是一个旧版本(可能会遇到兼容性问题).

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).

这篇关于org.springframework.web.bind.annotation.RequestMapping缺少什么依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆