I am trying to consume a Rest CRUD API with Feign Client. I've added the HATEOAS dependency to the Client application.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
And here is the Client Interface
@FeignClient(name="core-service")
@RibbonClient(name="core-service")
public interface VoteClient {
@RequestMapping(method = RequestMethod.GET, path = "/candidates")
Resources<Candidate> getCandidates();
@RequestMapping(method = RequestMethod.GET, path = "/candidates/{id}")
Resource<Candidate> getCandidate(@PathVariable("id") long id);
}
But Here I still have "Candidate cannot be resolved to a Type" How can I do to read Candidate, which an Entity in the Rest Service, in the Rest Client ?
It's a Java compiler error. The client needs Candidate.java imported on the client. It can be fixed with "Fix Project Setup" on the IDE, or adding the library to the classpath and importing the relevant package.