【发布时间】:2020-06-19 09:58:18
【问题描述】:
我无法导入任何 HATEOAS 元素,尽管它似乎已在我的 build.gradle 中正确实现:
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
这是我的导入:
import org.springframework.hateoas.Resource;
import org.springframework.hateoas.Resources;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.*;
以下是错误:
$ ./gradlew build
> Task :compileJava FAILED
path\src\main\java\payroll\EmployeeController.java:5: error: cannot find symbol
import org.springframework.hateoas.Resource;
^
symbol: class Resource
location: package org.springframework.hateoas
path\src\main\java\payroll\EmployeeController.java:6: error: cannot find symbol
import org.springframework.hateoas.Resources;
^
symbol: class Resources
location: package org.springframework.hateoas
path\src\main\java\payroll\EmployeeController.java:15: error: package org.springframework.hateoas.mvc does not exist
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.*;
^
path\src\main\java\payroll\EmployeeController.java:41: error: cannot find symbol
Resource<Employee> one(@PathVariable Long id) {
^
symbol: class Resource
location: class EmployeeController
4 errors
我认为这无关紧要,但我正在使用 IntelliJ 并尝试完成本教程:https://spring.io/guides/tutorials/bookmarks/
我在谷歌上搜索该问题时找不到任何解决方案,而且我真的不明白问题是什么,所以我不知道还能尝试什么。
【问题讨论】:
标签: java spring-boot gradle hateoas