I am following Spring in action 5th edition to learn Springboot. When I am in chapter 6, I find that my IDEA IDE seems to have a bug for bean org.springframework.hateoas.server.EntityLinks.
package tech.enigma.web.api;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.hateoas.server.EntityLinks;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.enigma.Taco;
import tech.enigma.data.TacoRepository;
@RestController
@RequestMapping(path = "/design", produces = "application/json")
@CrossOrigin(origins = "*")
public class DesignTacoController
{
private TacoRepository tacoRepo;
private EntityLinks entityLinks;
public DesignTacoController(TacoRepository tacoRepo, EntityLinks entitylinks)
{
this.tacoRepo = tacoRepo;
this.entityLinks = entitylinks;
}
@GetMapping("/recent")
public Iterable<Taco> recentTacos()
{
PageRequest page = PageRequest.of(
0, 12, Sort.by("createAt").descending());
return tacoRepo.findAll(page).getContent();
}
}
At public DesignTacoController(TacoRepository tacoRepo, EntityLinks entitylinks) Constructor, IDEA gives an error "Could not autowire. No beans of 'EntityLinks' type found." I can compile and run my program although I am not sure it works properly. Other beans all works ok. Is this just a bug of IDEA or I got something wrong?