首页 > 解决方案 > 在 webflux 应用程序中添加 hatoas 支持后控制器抛出错误

问题描述

将 RepresentationModel 添加到我的实体时,我在从数据库获取数据时收到错误消息。我可以毫无问题地发帖。

@Document(collection = "airports")
public class Airport extends RepresentationModel<Airport> {

  @Id
  private String icao;

}

和控制器

@GetMapping
public Flux<Airport> getAirports() {
  return repository.findAll();
}

我收到以下错误:

java.lang.IllegalStateException: Cannot set property links because no setter, no wither and it's not part of the persistence constructor public com.example.mongo.entities.Airport()!

我认为可能是lombok的问题,并手动实现了构造函数、getter和setter,但无济于事!

标签: javaspringmongodbspring-webfluxspring-hateoas

解决方案


推荐阅读