0

似乎当我添加 spring-hateoas 的依赖项时

<groupId>org.springframework.hateoas</groupId>
    <artifactId>spring-hateoas</artifactId>
    <version>0.13.0.RELEASE</version>

下面的类在类路径中不再可用

org.springframework.web.bind.annotation.RestController;

我试图排除 spring-hateoas 的各种依赖项,但 APP 不再运行。

有没有人在春季靴子中运行 spring-hateoas 运气好。

4

1 回答 1

1

绝对没有任何问题。注释仍然可用,@RestController您不需要进行任何排除。

如果有帮助,我目前使用的是 Spring Boot 1.0.2 版:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.2.RELEASE</version>
</parent>

spring-boot-starter-web提供@RestController

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

我没有spring-hateoas在我的中定义明确的版本pom.xml,但我的构建正在拉入0.9.0.RELEASE

<dependency>
    <groupId>org.springframework.hateoas</groupId>
    <artifactId>spring-hateoas</artifactId>
</dependency>

作为旁注,我可以从 Eclipse POM 编辑器中看到,Spring HATEOAS 正在定义对 Spring 3.2.7 的依赖关系。但是,该spring-boot-starter-parent项目管理的版本最高为 4.0.3。你能看到你得到的是什么版本的 Spring 吗?您可能没有将其spring-boot-parent用作父项目吗?

于 2014-06-26T08:11:57.993 回答