Mas*_*y24 6 java spring spring-mvc maven spring-web
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?
Cor*_*ist 18
我有一个类似的问题,我通过进入我的 pom.xml 文件并从以下位置更改 spring boot 依赖项的 artifactID 来修复它:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
到
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
Run the following command
mvn clean install
Run Code Online (Sandbox Code Playgroud)
如果您正在使用像intelliJ idea或Eclipse这样的IDE,请确保重新导入项目。这是一个如何在Eclipse中刷新Maven依赖关系的答案
| 归档时间: |
|
| 查看次数: |
10397 次 |
| 最近记录: |